hibernate 不能自动建表

来源:互联网 发布:投资数据分析 编辑:程序博客网 时间:2024/05/18 22:41

使用hibernate的时候不能自动建表,有几种方法排除

1.确定hibernate的包的导入

2.在hibernate.cfg.xml文件中<property name="hbm2ddl.auto">     的值为create。这个属性值有几种,当为create 时,为自动建表

3. 在hibernate.cfg.xml文件<property name="dialect">   org.hibernate.dialect.MySQLDialect    的问题,即使是Mysql  数据库,根据引擎的不同有三种方言

 org.hibernate.dialect.MySQLDialect 
 org.hibernate.dialect.MySQLInnoDBDialect 
 org.hibernate.dialect.MySQLMyISAMDialect 
看自己是开了什么引擎,不知道就一个个试一下吧

0 0
原创粉丝点击