Forums Register Login

Passivation Question

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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.

 
+Pie Number of slices to send: Send
 

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



Excellent! Thanks!
Beauty is in the eye of the tiny ad.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 529 times.
Similar Threads
spring wont inject the entitymanager
EntityManager persist problem in oneToMany relation
Confusion in accessing ENTITY bean
How is EntityManager thread-safe in Session Beans?
How to inject EntityManager via setter in spring
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 08:55:42.