I am developing a web application with java 2 ee. I also use hibernate and mysql. in order to restore the backup file, in some point in my application i need to drop the cur
You need to add the following property to your configuration:
Drop and Recreate everytime SessionFactory is created and destroyed:
<property name="hbm2ddl.auto">create-drop</property>
Other possible options:
for future googlers : it was so simple after all , i just needed to build session factory so i added this line and it worked like charm :
new Configuration().configure().buildSessionFactory();
note that buildSessionFactory()
is deprecated in hibernate 4 but i guess you can use the code here to do the same.