Short answer, when using the JTATransaction factory hibernate will actually locate and begin the user transaction when you begin a hibernate transaction. If the user transaction is already in progress hibernate hooks in with it.Have a look at the begin method of the JTATransaction http://fisheye.jboss.org/browse/~raw,r=9601/Hibernate/trunk/Hibernate3/src/org/hibernate/transaction/JTATransaction.javaMy understanding is that if you're always running in a JTA environment you can basically use Hibernate Transactions and User Transaction interchangeably.from:http://forum.hibernate.org/viewtopic.php?p=2323900&sid=74b4016db8b87320406d3cf301d60963

解决方案 »

  1.   

    简单的说.JTATransaction是java的一个线程事务管理,但是不可嵌套。
    而net.sf.hibernate.Transaction是数据库的事务,可嵌套。
    我们开发用的时候可以交互使用。这样理解,对么。 
      

  2.   


    简单的说javax.transaction.UserTransaction是java的一个线程事务管理,但是不可嵌套。 
    而net.sf.hibernate.Transaction是数据库的事务,可嵌套。 
    我们开发用的时候可以交互使用。这样理解,对么。