[jboss-user] [JBoss Seam] - Re: Complex Search Results - return object identifiers inste

jfrankman do-not-reply at jboss.com
Fri Jun 22 09:55:33 EDT 2007


I agree that lazy instantiation is the best way to go, but my problem with the lazy instantiation is that I have trouble keeping my objects in the session. My seam action classes call my business layer to get all objects:

i.e. List clients=clientService.findByLastName("Doe");

This works fine to display the search results, but when I click a detail row to go to the detail page I get lazy initialization errors:

client.getPolicies(); <-- produces lazy initialization error.

I think the problem is that the call to the entity manager is buried in my DAO layer and is not in the action itself. In other words, my action calls the business layer which in turn calls the DAO layer to get the object.  Because the EntityManager is not in the action I get lazy initialization errors, is this correct? Am I going about this all wrong?

I know there must be a way to do this, but others have complained about this problem as well: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=62275

I cannot quite understand how to keep the object in the session between pages I keep getting LazyInitialization errors on all subsequent pages. What am I doing wrong?

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

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



More information about the jboss-user mailing list