This week's book giveaway is in the Security forum.
We're giving away four copies of Penetration Testing Basics and have Ric Messier on-line!
See this thread for details.
Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UserTransaction vs EntityTransaction and distributed transactions

Raf Szczypiorski
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could anyone tell me the answers to there questions:
1. I can have a bean with CMT, but persistence that is "resource-local", meaning that it is not created by the container, but using Persistence.createEntityManagerFactory(). When the bean method is invoked, what is the relationship between the UserTransaction used behind the scenes by the container, and the EntityTransaction (which I think I must use, because if I don't, the provider - TopLink in my case - moans it needs a transaction)? Is the user transaction suspended, or are these two transactions completely unrelated?

2. I created my custom DataSource to be able to connect to Oracle, chose persistence to be of type "JTA", and specified this in the <jta-data-source> element of persistence.xml. It all works fine, the container crates and injects the EntityManager for me. However, the actual type of my data source was OracleXADataSource. So I gather it can be part of a distributed transaction - UserTransaction. What if it was not XADataSource? How would the container behave? Could it participate in UserTransaction?

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic