• 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

Passivation Question

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello:

I have a stateful bean which has an EntityManager "injected" into it thusly:

@PersistenceContext(name="myDataSource")
EntityManager em;

My question is this: when my bean is passivated, what happens to its EntityManager?

Do I need to do a JNDI lookup or something on PreActivate? Seems like this should be pretty common, but I have not found anything on it, which makes me think I'm nuts somehow!
 
Ranch Hand
Posts: 364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The specification covers this, no need to code anything:


If the session bean instance stores in its conversational state an object reference to a container-managed
EntityManager or to an EntityManagerFactory obtained via injection or JNDI lookup, the
container must be able to save and restore the object reference across the instance�s passivation.

 
Bradley Rintoul
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Edvins Reisons:
The specification covers this, no need to code anything:



Excellent! Thanks!
 
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic