读书人

hibernate自动生成表构造

发布时间: 2012-09-11 10:49:03 作者: rapoo

hibernate自动生成表结构
hibernate Annotation不用SchemaExport也可以生成表呀,只要在sessionFactory配置的过程中
<property name="hibernateProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>

其中update表示加载hibernate自动更新数据库结构,你也可以用create,但这样你数据库中的所有数据都会被清除,估计你现在写的是none,所以不会自动生成

读书人网 >软件架构设计

热点推荐