开发者

Restarting a Roo-application flushes its correspondant MySQL-table

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜