【问题标题】:How to make hibernate to drop one table and leave other?如何使休眠以删除一张桌子并离开另一张桌子?
【发布时间】:2013-04-03 11:20:13
【问题描述】:

我的 hibernate.cfg.xml 中有这段代码

 <property name="hbm2ddl.auto">create</property>

这意味着每次我运行应用程序时,hibernate 都会删除所有表并创建新表。

我如何指定它应该只删除一些特定的表,比如“汽车”? hibernate 有这种配置选项吗?

【问题讨论】:

标签: java mysql xml hibernate configuration


【解决方案1】:

不要使用hbm2ddl.auto - 这在生产中是一件非常糟糕的事情,只能用于早期测试目的。

你问了什么:不,hibernate 不能使用标准功能做到这一点。

我可以建议您查看 Liquibase 框架以进行任何数据库更新。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-20
    • 2011-10-09
    • 2020-07-29
    • 2012-05-23
    • 1970-01-01
    • 1970-01-01
    • 2019-02-25
    • 2014-01-24
    相关资源
    最近更新 更多