Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

CMR and Local interface

 
KasiMurugan Ramasamy
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

Can anybody say, why CMR applicable to local interafaces. I mean if we want CMR, the target entity of a relationship must have a local interace. My question is cmr depends on only local interaface.


Thanks & Regards
Kasimurugan R.
 
Joice Jose
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A relationship is completely managed by whom the relationship is owned. For example if a judge owned cases these cases are managed by the judge. Here relationship is between judge and caseid(reference Professional EJB). The ejb client don�t want to directly manage this cmr field and in the above example methods from the judge bean is managing cases and that method is is part of judge ejb itself. Hence relationship should be local

------------------
-Joice
 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so supose the judge entity has remote and local interfaces and the cases only have local interface. If a client (outside the container) looks up a judge, he will not be able to retrieve its cases then ?

(This example assumes not working with transfer objects)
 
Joice Jose
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You know, this judge and cases are dependent objects. Through the judge we can manage cases. That is the methods of judge are managing cases. And through this methods a client can access or modify cases.
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Would like to add the performance problem that we will encounter if specs would have allowed the remote relationships. In the above case you can have methods to return the cases in the judge entity bean.

As the relationships are local it helps in saving those remote calls that will make life hell.

 
Jim Janssens
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note: this discussion is actually not needed, you simply do not want to use entity beans as remote. In fact, you do not want to use entity beans at all if you ask me But I know its important for the exam.

If you are looking up a judge, you can bet the client is also interested in one or more cases the judge is doing. Entity beans do not allow that you pass the relationship (which is only local view) to the client, meaning that a client cannot get the cases on which the judge is working on.

A solution (also mentioned in the spec) would be to use TO's. You would create a getter that, when called, traverses the local relationship in the entity bean and puts them into a collection of TO's which are in turn returned to the client.

+ You have a form of lazy loading, since the cases are only loaded when the client requested them. On the other hand, its not complete lazy loading since all the cases are loaded at once (supose the client only needed one case). You can always extend the getter with some arguments in which you can for example specify how much cases you want to be returned.

+ The information is returned in one call completely. I do not know what happens if you return remote interface of an entity bean, but I suspect that doing multiple getters may result in multiple network calls.

- If the cases have relations to other entities, for example 'persons' (a case exists because several persons have a delict) than you must use the foreign key of person located in the the case TO, to load the persons from the person entity bean.


Anyway, I do also not see a clear reason why remote is not allowed for CMR. sure, it can cause performance issues, but then again for small applications it could be very handy. And as always, you have to understand the technologie you are working with otherwise performance will always be an issue...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic