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: Hibernate deletes Entries at startup
PostPosted: Fri Jul 06, 2007 12:37 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
Hello,

I've just started using Hibernate and it looks really awesome, just wonderful :)

1.) However I've problems with making objects persistent.
When I execute the following code hibernate inserts as expectedone entry into my hsql-database. I can see that one row has been inserted using HSQLDB's Database manager.

When re-running the piece of code with commenting the persitence-stuff out (so that the code does only open and close a session) the existing row is deleted.
I really don't have any clue why Hibernate decides to delete an entry created just a run before.
Code:
Session session = HibernateUtil.getSessionFactory().openSession();
      
//Transaction tx = session.beginTransaction();      
//      Firma f2 = new Firma("musik5", "trasse 16", "440", "ewseds", "076768", "8787878", "linuxy@ail.com");
//      session.persist(f2);            
//tx.commit();
      
session.close();
HibernateUtil.getSessionFactory().close();


I am quite sure this is a very easy question, sorry that I did not find the answer myself :-/

2.) I would like to use Hibernate on every client. Will chaching be a problem if e.g. 100's of hibernate instances will access the same database?

Thank you in advance, lg Clemens


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 06, 2007 2:01 pm 
Beginner
Beginner

Joined: Tue Jul 03, 2007 8:47 am
Posts: 46
I found out the problem after tinkering arround.

The problem was that <property name="hbm2ddl.auto">validate</property> was set to "create" so everytime I started my server all schemas were re-created and the data was lost.

lg Clemens


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.