Hibernate hbm2ddl.auto,可能的值,以及它们的作用 [英] Hibernate hbm2ddl.auto, possible values, and what they do
问题描述
我正在查看 Hibernate hbm2ddl.auto
配置属性及其可能的值:
I am looking at the Hibernate hbm2ddl.auto
configuration property and its possible values:
验证
更新
创建
创建删除
所有这些值有什么作用?
What do all these values do?
Hibernate 参考文档 只简要介绍了 create-drop
,但没有说明其他值:
The Hibernate Reference Documentation only talks briefly about create-drop
, but doesn't say anything about the other values:
hibernate.hbm2ddl.auto
在创建 SessionFactory
时自动验证或导出模式 DDL 到数据库.使用 create-drop
,当 SessionFactory
显式关闭时,数据库架构将被删除.
Automatically validates or exports schema DDL to the database when the SessionFactory
is created. With create-drop
, the database schema will be dropped when the SessionFactory
is closed explicitly.
例如 验证
|更新
|<代码>创建代码> |创建删除
我在这些 Stack Overflow 问题中找到了非常有用的解释:
I found very useful explanations in these Stack Overflow questions:
但官方文档中仍然没有.
But still nothing in the official documentation.
推荐答案
您提供的链接已经是官方文档了.所以,到目前为止,没有什么比这更正式和更全面的了.
The link you provided is already the official documentation. So, there's nothing more official and comprehensive as-of today.
所以我想你的问题有两个答案:
So I guess the answer to your question is two-fold:
- 要么在 Hibernate 问题跟踪器中提交增强请求(最好使用提案)
- 或阅读对应代码
- either file an enhancement request in the Hibernate issue tracker (better with a proposal)
- or read the corresponding code
我知道这不是您梦寐以求的完美答案,但这实际上就是您今天所拥有的.
I know this isn't the perfect answer you dreamt about, but this is actually all you have today.
但好消息是该项目是开源的,因此您拥有帮助改进它所需的一切:-)
But the good news is that the project is open-source, so you have all you need to help improve it :-).
这篇关于Hibernate hbm2ddl.auto,可能的值,以及它们的作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!