This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate - difference btw JDBCTransactionFactory and JTATransactionFactory

 
ravi singasani
Greenhorn
Posts: 6
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
 
ravi singasani
Greenhorn
Posts: 6
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very clear. Thanks a lot Bill.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic