aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Mock question about EntityManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Mock question about EntityManager" Watch "Mock question about EntityManager" New topic
Author

Mock question about EntityManager

Benoît de Chateauvieux
Ranch Hand

Joined: Aug 10, 2007
Posts: 183
Hi all,

In the demo of Enthuware Mock for SCBCD5, I found this:

"Session beans that use container managed EntityManager cannot use bean managed transactions."

For me it's true but Enthuware says in its explanation:
"Transaction management type of a session bean and type of entity manager (container managed or bean managed) are two different things. Any type of entity manager can be enlisted in a transaction started by a session bean with bean managed transactions."

So... Can a Container Managed EntityManager be used with BMT Session Bean?
If yes, when does it join the UserTransaction ?

Thanks in advance.

Beno�t


SCJP5 | SCBCD5 | SCEA5 Part 1
Benoît de Chateauvieux
Ranch Hand

Joined: Aug 10, 2007
Posts: 183
Finally, I think that the Container Managed Entity Manager never joins the UserTransaction.

The specs (5.6.1) says:
"If the entity manager is invoked outside the scope of a transaction, any entities loaded from the database will immediately become detached at the end of the method call."

Your opinion ???
Narendra Dhande
Ranch Hand

Joined: Dec 04, 2004
Posts: 950
Hi,

Container managed persistence context is alway associated with the JTA transactions, which is always using CMT.

Thanks


Narendra Dhande
SCJP 1.4,SCWCD 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA 5.0
 
 
subject: Mock question about EntityManager