com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hibernate.id_gen' doesn't exist

时间:2022-12-15 08:24:16

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>