Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UserTransaction vs EntityTransaction and distributed transactions  RSS feed

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
Boost this thread!