Personal tools
You are here: Home Members rafiferoze Database Programming with Hibernate Hibernate Troubleshooting
Document Actions

Hibernate Troubleshooting

by Rafi Mohamed Feroze last modified 2007-08-27 21:41

Valuable lessons learnt from failure to read the manual cover to cover.

Data does not persist, yes, I invoked session.save() (or persist())
Ah..well..have you disabled hbm2ddl.auto=create property before re-starting the application? Hibernate manual in section 1.2.6 states that another run of hbm2ddl would drop everything you have stored

Wait a minute, don't you need the hbm2ddl.auto property to create the tables in the first run ?
It depends. If you are creating a file based memory database using HSQL, and if the database does not exist, then you need to set the hbm2ddl.auto property to create for the first run and then disable it for subsequent runs.

But, I am deploying this in tomcat, and I cannot go and modify data a war file after the first run. It has to be done before the 'war' is created
Well, the other option is to distribute an empty pre-configured database (.script and .properties file for file/memory databases). This will persist and preserve data on tomcat restart, but not if your application is re-deployed. To persist data across re-deployment, run database as a stand alone server or as a separate servlet.


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: