views:

978

answers:

2

1.may i know what is the different of both? both also supported by all database right?
2. jpa transactionmanager and jta transactionmanager different? can explain?

+2  A: 

Resource_Local and JTA are transaction managers (methods of doing transactions). This is not the property of database but the component responsible for coordinating transactions. JPA and JTA transaction managers are different. JPA transaction manager is responsible for JPA transactions and you want to use one if you are only doing JPA transaction. JTA transaction manager is general purpose transaction manager and can enlist other resources such as JMS queues in transaction. Typically Java EE containers employ a JTA transaction manager for EJBs, JPA entities, etc.

Chandra Patni
+2  A: 

JPA implementations have the choice of managing transactions themselves (RESOURCE_LOCAL), or having them managed by the application server's JTA implementation.

In most cases, RESOURCE_LOCAL is fine. This would use basic JDBC-level transactions. The downside is that the transaction is local to the JPA persistence unit, so if you want a transaction that spans multiple persistence units (or other databases), then RESOURCE_LOCAL may not be good enough.

JTA is also used for managing transactions across systems like JMS and JCA, but that's fairly exotic usage for most of us.

To use JTA, you need support for it in your application server, and also support from the JDBC driver.

skaffman