开发者

How do I reload a Roo project without clearing the database?

开发者 https://www.devze.com 2022-12-20 14:38 出处:网络
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 开发者_Python百科my defined entities and allows me to create, e

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 开发者_Python百科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,


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消