-->
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.  [ 5 posts ] 
Author Message
 Post subject: Keep the data persistent in the database after I exit my app
PostPosted: Wed Feb 16, 2005 12:47 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 5:18 pm
Posts: 44
Hi,

I download the caveatemptor and able to set it up to run with MySql. But everytime, the unit test finishes, all the data in the database is gone. I read the "Hibernate In Action" book , i think I can change this behaviour by changing the "hibernate.hbm2ddl.auto" property in the hibernate.properties file to "update", but that still does not work. The data still gone after the unit test done executing.

Can someone please help me with this?


Hibernate version: 2.1.6

Name and version of the database you are using: MySQL


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 12:52 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Set it to "create", this is documented in chapter 9.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 1:07 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 5:18 pm
Posts: 44
Thank you for your response. I change "hibernate.hbm2ddl.auto" to 'create', but the all the tables still got removed after all the junit tests is done.

I specifically set a break point in the testAuditLog() of AuditTest, the point after it makes an Item persistent. i.e. after here:
itemDAO.makePersistent(item);

// Synchronize state to trigger interceptor
HibernateUtil.getSession().flush();

I can see the database has an entry for that new item. But after all the test are done, the table is removed. Can you give me more pointers please?

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 6:35 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Uhm, check the TestCase superclass in the package, there might be a drop() in there. I don't remember right now and I'm too lazy to look. Somehow it was the easiest method to do trivial unit tests, so I never removed it. I also remember this was discussed here before.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 16, 2005 7:08 pm 
Beginner
Beginner

Joined: Fri Mar 12, 2004 5:18 pm
Posts: 44
Thanks a lot, you are correct. it is dropped in the tear-down of the test.


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