• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Concept understanding of Remote and Local Views

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,
I would just like some guidance on remote and local views for entity beans. I have been toying with the Movie-Director code from Head First EJB and have some modified it to test out my understanding on the remote and local view concepts but however, there were problems when I tried used the Tool Verifier in sun deploytool
ok here's the gist of what I am trying to do. I understand that in most cases, there would be either a remote view or a local view of an entity bean although both views would still be achievable. What I am trying to do is to implement both views to see how it would be done in the code. To my knowlege, the book only gives the code for the Movie part of the entity relationship but not the Director so I decided to get some hands on exp to implement the Director code. I hope a kind soul would be able to help to take a look at the code, the source code is very simple , its just that I have difficulty getting it verified. I believe the problem is very simple to solve but the thing is I don't know where or what the problem is. The code and ear file can be downloaded at http://f2.pg.briefcase.yahoo.com/bc/happygamer1978/lst?.dir=/headfirst&.view=l.
Basically what I want to do is to get both the Movie and Director to have remote and local views, local is because they have a 1:* relationship, remote is because I want the remote client to access the entity beans directly. I understand that a localhome is to return a local component interface and same thing with remote but what about the return values of the methods in the local component interface? are they to be local as well(I am not refering to standard return values like String or int but other entity beans)? I do believe that they have to be local as well. In the case of the MovieBean, because it has a relationship with the DirectorBean, I understand that the setter and getters type of the Director in the MovieBean is the local comp interface but what if I want the getter and setters to be remote so that they can be accessed by remote clients directly? How would I write that?
And another thing about relationships. I specified in the deploytool the 1:* many Movie and Director relationship, but when the tool verified failed, I looked at the Results.txt file and saw this entry:
***********************************************************
Test Name: tests.ejb.entity.cmp2.CmrFieldsAccessorExposition
Test Assertion: EJB 2.0 Spec 9.4.11 CMR accessor methods for other than one-to-one or many-to-one relationships between entity beans should not be exposed in the remote interface
Detailed Messages:
Error : CMR field get accessor method [ movies ] is exposed through the remote interface [ headfirst.Director ]
Error : CMR field set accessor method [ movies ] is exposed through the remote interface [ headfirst.Director ]
***********************************************************
so what gives? What I wanted to achieve was to enable someone with a MovieBean to get its director and someone with a DirectorBean to get its movies. If this is any useful, there is only one entry in the Relationships tab in the deploytool which specifies a 1:* relationship.
The other 2 entries in the Results.txt are:
***********************************************************
Test Name: tests.ejb.intf.localintf.LocalInterfaceMatchMethodReturn
Test Assertion: Remote interface business methods have matching method return type test
Detailed Messages:
For Local Interface [ headfirst.MovieLocal ] method [ getDirector ]
Error: No corresponding business method with matching return type was found for method [ getDirector ].
==============================
***********************************************************
***********************************************************
Test Name: tests.ejb.intf.localintf.LocalInterfaceMatchMethodArgs
Test Assertion: Local interface business methods have matching method arguments test
Detailed Messages:
For Local Interface [ headfirst.MovieLocal ] method [ setDirector ]
Error: No corresponding business method with matching arguments was found for method [ setDirector ].
==============================
***********************************************************

Thirdly, would the bean need to be aware that a call made to it is local or remote?if a remote call to a SessionBean to get an EntityBean is made and as far as the Entity Bean is concerned, the SessionBean is a local client, but the SessionBean need to return a remote comp interface to the remote client, so how does the code work out?
I have been stuck on this problem for some time already trying to figure out the concepts or remote and local views and how to write them correctly. I would appreciate if anyone could give me some enlightenment on this isssue. Thanks in advance!!
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't cross-post! Please.
For anybody that wants to contribute, this is already in the SCBCD forum: posting.
 
mooooooo ..... tiny ad ....
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic