Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Application Managed???

 
Nikhil Jain
Ranch Hand
Posts: 392
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bean Managed,
Container Managed
Application Managed,

Are these 3 terms different things.

As per spec
The methods close, isOpen, joinTransaction, and getTransaction are used to manage application-managed entity managers and their lifecycle.

but when you need to use Bean Managed transaction, you use em.getUserTransaction instead of getTransaction.

But I read somewhere, that getUserTransaction is recomm. instead of using getTransaction.
 
Mirko Bonasorte
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you speak about Application Managed, you are referring to persistence contexts. They are created by using EntityManagerFactory.
When you speak about Container Managed, you might be referring to persistence contexts or transaction context.
When you speak about Bean Managed, you are referring to transaction context.

When you have bean managed transaction, you use EJBContext.getUserTransaction() and this is a general rule, whether or not you use a persistence context (EJBContext, NOT em)
 
Vinay Nath
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Mirko, there is no getUserTransaction in EntityManager inetrface.

getUserTransaction return UserTransattion object
getTransaction returns EntityTransaction object
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic