[jboss-user] [Beginners Corner] - entities, clients, eager vs lazy fetch (ejb3)
do-not-reply at jboss.com
Tue Jul 18 19:40:09 EDT 2006
I have a newbie question that is probably so common there is probably a "pattern" that answers it.
I am building an app where the client code will allow the operator to display/edit an object's data. In order to do that the client must have access somehow to all the object's data, atleast depending on the "view" the client is displaying.
I can setup relationships to be "eager", but that seems like hitting a finishing nail with a sledge hammer. A client view really only needs acess to a subset of all the data associated with an object.
I can have several session bean methods that provide different "fetch-join" combinations - one for each client view. But this also seems inefficient.
What I really want is the session bean gets a subset of the data (entity and some of the related objects) and returns it to the client. Then somehow, whenever the client needs more data (i.e. calls entity.getWidgets(), when related widgets were not pre-fetched) it goes back to the database and gets those widgets.
Whats the proper way to do this?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3958985#3958985
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3958985
More information about the jboss-user