开发者

Restarting a Roo-application flushes its correspondant MySQL-table

开发者 https://www.devze.com 2023-03-23 02:10 出处:网络
I\'ve got a Roo-project. Its data is persisted into a MySQL-database (via Hibernate). When I restart Tomcat the Roo-applications correspondant MySQL-table gets completely flushed.

I've got a Roo-project. Its data is persisted into a MySQL-database (via Hibernate).

When I restart Tomcat the Roo-applications correspondant MySQL-table gets completely flushed. All data which is already in the table is deleted.

How can I keep the dat开发者_开发技巧a?


Try to play with Hibernate's persistence settings ({project_root}/src/main/resources/META-INF/persistence.xml). There is the line:

        <!-- value="create" to build a new database on each run; value="update" 
            to modify an existing database; value="create-drop" means the same as "create" 
            but also drops tables when Hibernate closes; value="validate" makes no changes 
            to the database -->
        <property name="hibernate.hbm2ddl.auto" value="update" />

Set there validate.

0

精彩评论

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