My standalone application already uses narayana transaction manager for JTA transaction with other XA resources and now I am trying to integrate it with Hiberante also. So that hibernate transactions also executes under narayana JTA transcation scope-
hibernate.cfg.xml
Code:
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.transaction.factory_class">
org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">
<!-- org.hibernate.transaction.JBossTransactionManagerLookup -->com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple
</property>
<property name="hibernate.current_session_context_class">jta</property>
other java conf -
Code:
registry.applySetting(AvailableSettings.JTA_PLATFORM, "org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform");
registry.applySetting(AvailableSettings.TRANSACTION_COORDINATOR_STRATEGY, "jta");
and here is how I am starting the transaction-
Code:
TransactionManager transactionManager =com.arjuna.ats.jta.TransactionManager.transactionManager();
transactionManager.begin();
Session session = currentSessionContext.currentSession();
session.joinTransaction();
System.out.println("is joined "+session.isJoinedToTransaction());
session.update(obj);
transactionManager.commit();
session.close();
sessionFactory.close();
Now problem is that db is showing the changes of session only after call to sessionFactory.close() but shouldn't it be at transactionManager.commit() .
How can I configure it to make db update after transactionManager.commit() ?