Hi everyone,
I am using hibernate 3.3.2 in ejb3 with jta
Code:
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="current_session_context_class">jta</property>
What I am trying to do in the ejb method is update the db and commit, then calling a remote web service, which also access the same db to proceed. And if the web service failed, the ejb method would do some manual rollback(since already previously committed).
However, it seems the db is in deadlock state after the first ejb commit and processing the web service. So I m wondering if the db is locked.
So my question is, will hibernate physically commit and release the db connection with the above configuration used? If not, how can I achieve it? Or should I have to use managed transaction instead?
Here's some code I used within the ejb method
Code:
try{
session = HibernateUtil.getSessionFactory().openSession();
tx = session.beginTransaction();
//do something
session.flush();
tx.commit();
}
catch(Exception err){
if (tx != null && tx.isActive()) tx.rollback();
}finally{
if(session != null && session.isOpen())
{
session.close();
}
}