-->
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: Hibernate & Flush tables
PostPosted: Wed Feb 01, 2006 6:48 am 
Newbie

Joined: Wed Feb 01, 2006 6:45 am
Posts: 1
Hi,

How can I flush tables using hibernate.

Thanks

Nik


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 6:08 pm 
Regular
Regular

Joined: Thu Sep 23, 2004 11:53 am
Posts: 83
If you mean flush the hibernate cache session.flush(). If you mean flush the acutal table I do not believe there is a way to do this through the Hibernate api.



You could setup the hibernate.cfg.xml file to delete and create the schema on startup, use this for development hibernate.hbm2ddl.auto. Automatically validate or export schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.

eg. validate | update | create | create-drop

<property name="hibernate.hbm2ddl.auto">create-drop</property>


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 01, 2006 6:18 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
what about
session.createQuery("delete from MyClassWhichSavedInThisTable").executeUpdate();


Regards Sebastian

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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.