How does the UserTransaction and the EntityManager interact?

喜你入骨 提交于 2019-12-02 20:43:01
  1. Because UserTransaction is part of Java Transaction API (JTA) and EntityManager is part of Java Persistence API (JPA). JTA is not part of JPA. JPA uses services provided by JTA.

  2. Isn't ManagedProperty is some annotation which is valid only in classes annotated with @ManagedBean. Maybe it was considered better to not inject UserTransaction different way in managed beans.

  3. JNDI lookup for active transaction. Reserved name seems to be java:comp/UserTransaction. One implementation: http://www.java2s.com/Open-Source/Java-Document/Database-ORM/hibernate/org/hibernate/transaction/JTATransactionFactory.java.htm

  4. It is not some sort of singleton, you can have more than one. But only one per thread can be active.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!