美文网首页hibernate
hibernate设置自动生成表

hibernate设置自动生成表

作者: 挖煤的小智 | 来源:发表于2018-12-01 15:48 被阅读14次

设置hibernate.hbm2ddl.auto(例如none(默认值), ,create-only,drop,create,create-drop,validate和update)
在spring集成hibernate中:

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

在springDataJap中:

spring.jpa.hibernate.ddl-auto = update

none
不会执行任何操作。
create-only
将生成数据库创建。
drop
将生成数据库丢弃。
create
将生成数据库删除,然后创建数据库。
create-drop
删除模式并在SessionFactory启动时重新创建它。此外,在SessionFactory关闭时删除架构。
validate
验证数据库架构
update
更新数据库架构

相关文章

网友评论

    本文标题:hibernate设置自动生成表

    本文链接:https://www.haomeiwen.com/subject/hchrcqtx.html