Win a copy of TensorFlow 2.0 in Action this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

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
  • 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
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic