gpt4 book ai didi

java - 是否有一个简单的工作流程可以从具有 hibernate 映射的类生成数据库架构?

转载 作者:行者123 更新时间:2023-11-30 05:10:14 24 4
gpt4 key购买 nike

我想定义我的对象,然后使用 hibernate 从中生成我的 ddl。但似乎 hibernate 唯一真正的工作流程是生成数据库模式,然后对其进行逆向工程。我想做一些没有意义的事情吗?

最佳答案

是的,有一个属性hibernate.hbm2ddl.autodocumentation说:

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.

e.g. validate | update | create | create-drop

定义此属性的方法有多种,具体取决于您配置 SessionFactory 的方式。 hibernate的方式就是简单的添加:

<property name="hibernate.hbm2ddl.auto">update</property>

关于java - 是否有一个简单的工作流程可以从具有 hibernate 映射的类生成数据库架构?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3674322/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com