• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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




 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic