-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Does Infinispan always require XA-datasource?
PostPosted: Fri Oct 15, 2010 3:15 am 
Newbie

Joined: Fri Oct 15, 2010 3:05 am
Posts: 2
I using Infinispan as a second level cache under Hibernate 3.3. Hibernate is configured to use JTA transactions in clustered Glassfish 2.1.1 enviroment. Isn't it possible to make Infinispan just hook on to already existent transactions using a regular data resource (ie non XA-resource). I get this exception when running a simple Hibernate Query: "Local transaction already has 1 non-XA Resource"

Note that I didn't get these exceptions using the ehcache config. here's my persistence.xml:

<persistence-unit name="entityManager" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/ejb/eur_unbranded</jta-data-source>
...
<!-- infinispan config -->
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
<property name="hibernate.cache.use_second_level_cache" value="true"/>
<property name="hibernate.cache.region.factory_class" value="org.hibernate.cache.infinispan.InfinispanRegionFactory"/>
<property name="hibernate.cache.infinispan.statistics" value="true"/>

Thanks in advance!

Martin


Top
 Profile  
 
 Post subject: Re: Does Infinispan always require XA-datasource?
PostPosted: Sat Oct 16, 2010 1:37 pm 
Newbie

Joined: Sun Sep 26, 2010 5:23 am
Posts: 7
Infinispan is of course a transactional cache. If you were using an EHCache version prior to 2.0, it was not transactional:
Quote:
The TRANSACTIONAL strategy is intended for use in an environment utilizing the Java Transaction API (JTA) to manage transactions across a number of XA resources. This strategy guarantees that a cache remains in sync with other resources, such as databases and queues.
The TRANSACTIONAL strategy is supported in Ehcache 2.0 and higher.

See: Terracotta Distributed Ehcache for Hibernate Reference

What caching strategy are you using for your entities? E.g.
Code:
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)

or
Code:
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)

?


Top
 Profile  
 
 Post subject: Re: Does Infinispan always require XA-datasource?
PostPosted: Tue Oct 19, 2010 3:19 am 
Newbie

Joined: Fri Oct 15, 2010 3:05 am
Posts: 2
Thanks for the answear.

When we used EHCache, we mostly used CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, but I managed to have CacheConcurrencyStrategy.TRANSACTIONAL on ehcache to work without an XA resource (i.e. by using a plain data source without distributed transaction support). Maybe that was 1.0 version then?

So, if we're gonna use Infinispan, we have to configure it for CacheConcurrencyStrategy.TRANSACTIONAL and use XA-data rources?
Regards,
Martin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.