hibernate的hibernate.hbm2ddl.auto属性

来源:互联网 发布:淘宝cdkey怎么发货 编辑:程序博客网 时间:2024/05/16 14:55

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


解释如下:

hibernate.hbm2ddl.auto Automatically validate or export 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.  eg. validate | update | create | create-drop

 

这个参数的作用主要用于:自动创建|更新|验证数据库表结构。
如果没有此方面的需求建议set value="none".

其它几个参数的意思:

 validate               加载hibernate时,验证创建数据库表结构
 create                  每次加载hibernate,重新创建数据库表结构
 create-drop        加载hibernate时创建,退出是删除表结构
 update                 加载hibernate自动更新数据库结构

原创粉丝点击