-->
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: [HSQLDB] Strange behaviour - fails/success predictable
PostPosted: Tue Mar 16, 2004 5:45 am 
Beginner
Beginner

Joined: Tue Mar 16, 2004 5:15 am
Posts: 33
Hi forum,

I 've created an HSQLDB+JUnit test suite while trying to adapt some things I've learned while reading the book 'Java Open Source Programming - with ...'.

I am not a newbee to hibernate but slightly for HSQLDB + hibernate, maybe I am trying something stupid, but it seams too strange for me.


What I have:

-HSQLDB 1.7.1
-Hibernate 2.1
-Eclipse 3.0 M6 Plain Java Project

-A class called Product which is mapped to the table 'PRODUCTS'. It only has one id of type integer and the generator in use is 'identity'.
-A class called HibernatePersistenceManager which initalizes a hibernate session using a session factory AND uses new SchemaUpdate(config).execute(false,true) to ensure every required table is created.

-A TestCase for testing the HibernatePersistenceManager


So what's wrong?

- Well I have a test case for the manager, just for testing if it does its duty. To check how many rows a table has, I get a connection from the session and request the count of rows using select count(*) from 'tablename'.
- I have a couple of test methods named testEmpty1 to testEmpty20. Every method looks the same and checks if the number of rows of the 'PRODUCTS' table is zero. (Simply it fails if the table does not exist).

And now comes the wired thing:
- The testEmpty1 (first one) and the testEmpty5 (fith one) fails. The reason is: table PRODUCTS does not exist.
- If I am calling SchemaUpdate.execute(...) twice on init, the first and the third testEmpty* fails.
- If I am calling SchemaUpdate.execute(...) once but add a class mapping for category (looks like Product but maps on table 'CATEGORIES') also the first and the third fails.

I am very puzzled. Restarting the computer doesn't help and everytime I run the test the same result occurs. So it is reproducable but beyond my horizon.

Except those two calls everything else works like expected. I can add products, get products and all the stuff (using more complex tests to test additional behaviour) but the first and the third (or first or fiths) fails all the time.

Can someone give me a pointer or verify this? I think I've found a bug but I can not be the first one I guess :-)


Thanks,

Martin (Kersten)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 16, 2004 7:07 am 
Beginner
Beginner

Joined: Tue Mar 16, 2004 5:15 am
Posts: 33
Well finally it seams like I experienced a bug (a fat one, scared me like hell!). Well after switching to HSQLDB 1.7.2 RC3 it has gone. Everything works like expected (except it is very slow).

So it wasn't Hibernate's fault and the folks driving HSQLDB are already aware of the gap, so lets go back to work.


Thanks for watching,

Martin (Kersten)


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.