源自:-
不能自动创建表,保存报错。手动创建表,保存没有问题。
求助hibernate不能自动建表,mysql版本5.1.42,hibernate3.方言配置:(我试过很多个方言MySQLInnoDBDialect MySQL5InnoDBDialect MySQL5Dialect HSQLDialect 等)
org.hibernate.dialect.MySQLDialect
ddl配置:
update
目前的问题是不能自动建表,数据库已经创建过了。调用dao方法,不能自动建表,导致保存数据错误:
HTTP Status 500 - could not insert: [cn.muke.ssh.domain.Product]; SQL [insert into product (pname, price) values (?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: could not insert: [cn.muke.ssh.domain.Product]
具体原因(部分):
root cause
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ssh.product' doesn't exist
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
如果把表建好,执行dao的相关操作,没有问题。
提问者:慕粉3763154
2017-02-14 16:41