| Author |
Hibernate - difference btw JDBCTransactionFactory and JTATransactionFactory
|
ravi singasani
Greenhorn
Joined: Mar 25, 2010
Posts: 6
|
|
Hello,
what is the advantage of using JTATransactionFactory over default JDBCTransactionFactory ?
I mean in hibernate config file, we can set hibernate.transaction.factory_class to org.hibernate.transaction.JTATransactionFactory else it will use default org.hibernate.transaction.JDBCTransactionFactory.
Please clarify on the advantage of one over the other.
thanks
Ravi Shankar
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
Please see the reference documentation here:
http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#configuration-optional-transactionstrategy
|
[How To Ask Questions][Read before you PM me]
|
 |
ravi singasani
Greenhorn
Joined: Mar 25, 2010
Posts: 6
|
|
Thanks Bill.
I was reading that before. What I didnt understand is, say If I have a J2EE server (Jboss) and I am running a non-EJB application,
then does picking either one of JDBCTransactionFactory / JTATransactionFactory will make any difference ?
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
|
Typically you need an application server's JTA capability only if your application needs to handle transactions across multiple resources, which is not a requirement for many applications.
|
 |
ravi singasani
Greenhorn
Joined: Mar 25, 2010
Posts: 6
|
|
Thanks. When you say "if your application needs to handle transactions across multiple resources", does multiple resources mean,
some other resource parallel to a database connection (jdbc) ? do I understand it correctly ?
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
Basically when you have to update multiple back-end systems in the same transaction. This might be multiple databases or another example may be processing JMS messages from a queue and inserting the results in a database. In this case one resource is the database and the other resource is the JMS queue. You would not want a failure to cause a loss of messages whose results are not yet stored in the database.
In either event the key is multiple resources in the same transaction.
|
 |
ravi singasani
Greenhorn
Joined: Mar 25, 2010
Posts: 6
|
|
|
Very clear. Thanks a lot Bill.
|
 |
 |
|
|
subject: Hibernate - difference btw JDBCTransactionFactory and JTATransactionFactory
|
|
|