hibernate中hibernate.hbm2ddl.auto配置講解

介紹其中的一個屬性hbm2ddl.auto,這個就是這個方案的核心屬性,有四個值:create,create-drop,update,validate;數據庫

 

<!-- 啓動時刪數據庫中的表,而後建立,退出時不刪除數據表hibernate

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

<!-- 啓動時刪數據庫中的表,而後建立,退出時自動刪除全部表數據

<property name="hibernate.hbm2ddl.auto">create-drop</property>-->validate

<!-- 自動修改,若是表結構與實體類不一致,那麼就修改表使它們一致,數據會保留

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

<!-- 自動校驗,若是表結構與實體類不一致,那麼不作任何操做,報錯

<property name="hibernate.hbm2ddl.auto">validate</property>-->

相關文章
相關標籤/搜索