-->
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: h2 database reset when i restart tomcat
PostPosted: Sat Feb 02, 2008 12:22 pm 
Beginner
Beginner

Joined: Wed Oct 03, 2007 9:46 pm
Posts: 37
anyone experience, h2 database reset and all records that you previously entered into db gone when tomcat is restarted?

below is my configuration


<property name="connection.username">sa</property>
<property name="connection.url">
jdbc:h2:~/mydb
</property>
<property name="dialect">
org.hibernate.dialect.H2Dialect
</property>
<property name="connection.password" >pass</property>
<property name="connection.driver_class">
org.h2.Driver
</property>


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 02, 2008 1:55 pm 
Regular
Regular

Joined: Mon Aug 20, 2007 6:47 am
Posts: 74
Location: UK
Hi there. Not sure if this will help but I had the same problem as you for a while. In the end I noticed I had put the following property into the config by mistake:

Code:
hibernate.hbm2ddl.auto=create-drop


Pretty stupid mistake, as it drops the entire schema when the sessionFactory gets closed!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 02, 2008 2:16 pm 
Newbie

Joined: Tue Jan 22, 2008 9:53 am
Posts: 18
Probably thats the problem:

hbm2ddl.auto

All the examples in the internet bring this proporty set. (sometimes this property can be located in your hibernate xml config file)

The value for this property should be always "validate"

Other values re-create the database always you restart the container, or reset all the records. The correct value to keep the data is validate.
Leave this property blank is not recomended (though hibernate will assume that is validade when not supplied) because putting this property in your config file you won't forget its existence and function if you decide to reuse yourconfig file in another project.


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.