views:

107

answers:

1

I've been learning how to build projects using Roo and am making good progress. I have the nucleus of a project which correctly displays my defined entities and allows me to create, edit, and delete the representative objects. I am using mysql at the database and I see that objects entered using the UI correctly appear in the mysql database. Per the Roo instructions, I am starting the webapp using "mvn tomcat:run".

Unfortunately, I've discovered that whenever I restart Tomcat using Maven, it clears all of the existing objects out of the database. I'm left with empty tables. It seems to do this as the final step just prior to Tomcat stating that the server has started.

I know this is just me being a n00b, but searches haven't been very helpful, none of the project's XML files seem relevant,

+3  A: 

I'm familiar with one situation that causes the database to be cleared when Tomcat is restarted. That's when your hibernate properties file has a line like this:

hibernate.hbm2ddl.auto=create

If you have such a line, change create to update.

Reference material at http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html

A more descriptive blog entry from Eyal Lupu.

John
That did it. Thanks. I was so close. I saw that parameter but didn't experiment with it.
Omniwombat