Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 247559

JTA and Hibernate integration

$
0
0

Hi

 

I am checking if it is possible to integrate Hibernate's JTA TransactionFactory to lookup/follow GemFire's transaction manager as JTA provider.

 

I am trying to execute a set of operations as described below as a part of function execution.

I want myregion.put &  factory.getCurrentSession().update(...) to be part of same underlying JTA Transaction that is started by using GemFire as JTA Provider

try{
    Context ctx = Cache.getJNDIContext();
    UserTransaction tx = (UserTransaction)ctx.lookup("java:/UserTransaction");
                                tx.begin();    // Do some work    factory.getCurrentSession().update(...);    myregion.put(...);    tx.commit();}catch (RuntimeException e) {    tx.rollback();    throw e; // or display error message}

more details can be found here under Transaction Demarcation with JTA : https://community.jboss.org/wiki/SessionsAndTransactions

 

After tx.commit();, I do not see hibernate applying changes to database.

 

I have provided system property as below, as it is suggested in another thread, after which Hibernate is able to locate transaction in JNDI

 

System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.gemstone.gemfire.internal.jndi.InitialContextFactoryImpl");

 

Am I missing something here?

 

thanks


Viewing all articles
Browse latest Browse all 247559

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>