File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mock question about EntityManager

 
Benoît de Chateauvieux
Ranch Hand
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Benoît de Chateauvieux
Ranch Hand
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 951
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic