Hi
When I use net.sf.hibernate.transaction.JTATransactionFactory and update date tables, it indicates successfully. But the content in database didn't change. But when use net.sf.hibernate.transaction.JDBCTransactionFactory, it works fine. Does anyone know why and how to solve it?
Fine settings:
<property name="transaction.factory_class">net.sf.hibernate.transaction.JDBCTransactionFactory</property>
<property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</property>
Problem settings:
<property name="transaction.factory_class">net.sf.hibernate.transaction.JTATransactionFactory</property>
<property name="transaction.manager_lookup_class">net.sf.hibernate.transaction.JBossTransactionManagerLookup</property>
The code for update looks like:
Session session = null;
Transaction transaction = null;
try {
session = ServiceLocator.getConnection();
transaction = session.beginTransaction();
session.saveOrUpdate(object);
session.flush();
transaction.commit();
return customer;
} catch (HibernateException e) {
if (transaction != null) {
try {
transaction.rollback();
} catch (HibernateException e1) {
throw new DAOException(e1);
}
}
logger.error(e.getMessage());
throw new DAOException(e);
} finally {
if (session != null) {
try {
ServiceLocator.closeConnection();
} catch (HibernateException e) {
logger.warn(e.getMessage());
}
}
}
Thanks for help!
|