-->
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.  [ 2 posts ] 
Author Message
 Post subject: running criteria queries many times returns empty list in h2
PostPosted: Wed Oct 15, 2008 4:48 pm 
Newbie

Joined: Thu Nov 08, 2007 5:02 pm
Posts: 6
I am trying to use a local persistence engine such as H2 or HSQL and I ran into a problem during testing. Whenever I do a criteria query I get the correct results. However, if I then perform the same query back to back the second returned list is always empty.

example :
//this list will contain the correct data:
List correctList = this.session.createCriteria(SomeMappedClass.class).list();

//If I perform the same criteria query again I now get an empty list
List emptyList= this.session.createCriteria(SomeMappedClass.class).list(),

I have run this test on both h2 and hsql; both have the same problem.

Any ideas?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 16, 2008 2:24 pm 
Newbie

Joined: Thu Nov 08, 2007 5:02 pm
Posts: 6
I found that if I wrap all insertions in transactions, the problem goes away. I thought that the default was autoCommit, but apparently even flushing the session isn't enough without a commit.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.