Hello,

yesterday I was thinking about another approach that I will might consider for 
my apps with remote clients. Heinrich wrote that he creates different accessor 
methods in session beans for different use cases.
Wouldn't it be nice to use only one method? 
Example:
Let's assume one has a complex customer order entity bean. The line items are 
marked to be fetched lazy. On the remote client it should be necessary to get 
the customer order object only without and with the collection of line items.
Why don't we build the method like this

  | CustomerOrder getCustOrderById(int id,int loadLevel)
  | {
  |   CustomerOrder order = (CustomerOrder) em.find(...);
  |   if(loadLevel > 1)
  |   {
  |     order.getLineItems();
  |   }
  |   return order;
  | } 

I would define a load level of type integer to cover even more complex entity 
beans with a bigger object tree.
As the client developer (hopefully) knows the structure of the entity beans it 
is up to him to select what parts of the tree he wants to load. 

The advantages a clear:
- You don't need awful value objects
- You don't have to create different methods for every use case


What do you think about this?



View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3910205#3910205

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3910205


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to