users@glassfish.java.net

Re: basic question to lifecyle entitymanager

From: <glassfish_at_javadesktop.org>
Date: Thu, 26 Jun 2008 06:21:34 PDT

>>** Question2: If i inject a entitymanager in SessionBean1 step 1), is this the same instance of the entitymanager as the instance injected in step2 to SessionBean2 ?

From what you've described, step1 and step2 share the same persistence context, and the same JTA transaction context.

>>So, if i inject Enitiymanagers in every Bean(required-transactions) in the CallFlow - is it always the same entitymanager ?

If the same transaction context is propagated across all components, and the injected EntityManagers are configured in the same way, then the same persistence context is also propagated.

If you have more questions, please post your code.

-cheng
[Message sent by forum member 'cf126330' (cf126330)]

http://forums.java.net/jive/thread.jspa?messageID=282766