java后台所提示的错误: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hibernate.id_gen' doesn't exist
11:26:56,984 ERROR JDBCExceptionReporter:101 - Unknown table 'hibernate_sequence' in field list
Junit4测试所提示错误:
org.hibernate.exception.SQLGrammarException: could not get next sequence value
出现这个问题是因为hibernate.cfg.xml的配置错误,我的错误是修改了mysql连接配置,而没有修改hibernate方言
如:
<property name="connection.driver_class">com.mysql.jdbc.Driver</property> <property name="connection.url">jdbc:mysql://127.0.0.1:3306/hibernate</property> <property name="connection.username">root</property> <property name="connection.password">centre</property> <property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
本文解决了一个因Hibernate配置文件中数据库方言设置错误导致的异常问题。具体表现为Hibernate尝试从不存在的表中获取序列值,该问题源于配置文件中指定的数据库方言与实际使用的数据库不匹配。

1002

被折叠的 条评论
为什么被折叠?



