-->
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: new session gets not commited entity after Exception
PostPosted: Thu Nov 29, 2007 8:16 am 
Newbie

Joined: Mon Sep 10, 2007 9:30 am
Posts: 12
Hello all,

I use atomikos transactions for xa-transactions with hibernate.
Testing rollback of a xa-transaction over two datasources shows me an unexpected behaviour.

I use the following environment:
- hibernate 3.2.5.ga
- xa-transactions with jta (atomikos)
- a javax.transaction.UserTransaction is available in a JUnit-JNDIMock
Code:
<!-- JTA mittels ATOMIKOS -->
<prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop>
<prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</prop>
       
<!--
  2 = TRANSACTION_READ_COMMITTED       
-->
<prop key="hibernate.connection.isolation">2</prop>

<prop key="hibernate.cache.provider_class">org.hibernate.cache.NoCacheProvider</prop>


This is what the JunitTest does:
- start two new hibernate-sessions for the two datasources and a new hibernateTransaction for each
- create new entities eA and eB for every datasource
- eA is the working one and eB has set some wrong attributes to run into a constraint-error
- persist eA and eB with the matching session

- call hibernateTransaction.commit() for each --> commit for eB throws a db-error --> HibernateException --> close the two hibernateTransactions and the two sessions.

As expected result there is no entry for eA and eB in the databases.

Now comes the irritating result:
After that, but in the same JUnit-Testmethod, I create a new sessionB2 for datasourceB with factoryB.openSession() and try to load the not in the database existing entry for eB with sessionB2.get(type.toString(), (Serializable) keyValue);

But the new session finds an entry for eB! How is this possible? There is no secold-level cache activated.

And: if I try to debug this: then it works...

It would be very nice, if someone could give me a hint, what I'm doing wrong.

greetings


Top
 Profile  
 
 Post subject: Atomikos config
PostPosted: Thu Nov 29, 2007 2:25 pm 
Newbie

Joined: Thu Nov 29, 2007 2:18 pm
Posts: 2
Hi,

See http://wiki.atomikos.org/bin/view.pl/Ma ... ntegration

Also, make sure to use Atomikos datasources or JTA won't work.


HTH
Guy
http://www.atomikos.com - Reliability Through Atomicity


Top
 Profile  
 
 Post subject: Re: Atomikos config
PostPosted: Tue Dec 04, 2007 9:37 am 
Newbie

Joined: Mon Sep 10, 2007 9:30 am
Posts: 12
Hello Guy,

GuyPardon wrote:
See http://wiki.atomikos.org/bin/view.pl/Ma ... ntegration

Also, make sure to use Atomikos datasources or JTA won't work.


The problem is resolved: I didn't explicitly call rollback, if a commit has gone wrong. I changed this and now it works fine.

Thank you.


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.