• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTA - EJB container managed transaction

 
Amol Katyare
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JPA with EJB 2. I believe, entity manager is injected by the container only in EJB3, hence I have to get it from entity manager factory. Persistence.xml has transaction-type "JTA".

As I understand, EJB container manages the transaction in this scenario.

Suppose, I perform following databse operations.
e.g. In Bean1 - call merge()
perform delete()
call another merge()
call Bean2()
In Bean2 - call merge()

My question is does the container perform these operations in a single transaction?

If not, how can I come to know when the transaction is begin and when it is committed?

Please help.

Thanks,
Amol.
 
Amol Katyare
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I need to manage the transaction using the SessionContext.getUserTransaction().begin()& SessionContext.getUserTransaction().commit() ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic