• Post Reply Bookmark Topic Watch Topic
  • New Topic

Are JPA objects detached when they are passed over to the web side through a session bean?

 
David Rocks
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I stopped working on the total EJB stack about revision 2.1 and I have some questions on how the containers now act.

Basically is there still seperate web and ejb containers? If I call a session bean from a servlet/jsp/action to return a persisted object is that persisted object now detached or are the web and EJB containers merged into one now?

I ask this as I recently looked in on an EJB 3 project on JBoss 4.5 where you had to load up the persisted object with everything you thought it would need before passing it to the servlet as then it was detached. I cannot see this as a good solution.

Thanks




 
Manuel Alberto Quero
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello David,

The web container and EJB container are separated, so yes: once the object is outside the EJB, it becomes detached.
Thats why you must be very careful with fetch(LAZY/EAGER) configuration for retrieving mapped data.

Hope this helps,

Manuel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!