-->
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: Hibenrate wipes out data from database
PostPosted: Wed Oct 14, 2009 5:12 pm 
Newbie

Joined: Wed Oct 14, 2009 5:10 pm
Posts: 2
I am facing a strange scenario where the Java hibernate wipes out / deletes the previously stored data in the database table when you restart the program.
In the same running session, it works fine. The thing is why it should wipe out even when primary key is in place?
I am committing the data too in class files.


<id name="id">
<generator class="increment"></generator>

</id>

-------------

Transaction tx = null;
Session session = SessionFactoryUtil.getInstance().getCurrentSession();
try {
tx = session.beginTransaction();
session.saveOrUpdate(obj1);
// session.save(icall);
tx.commit();

}

Above 'id' is primary key in the table. Any help would be appreciated.


Top
 Profile  
 
 Post subject: Re: Hibenrate wipes out data from database
PostPosted: Wed Oct 14, 2009 6:01 pm 
Newbie

Joined: Wed Oct 14, 2009 5:10 pm
Posts: 2
<property name="hibernate.hbm2ddl.auto">update</property>
solved the problem. Previously it was 'create'. Thanks to coderanch.com.


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.