关于Hibernate错误Unknown table 'system_sequences' in information_schema

很久没有弄Hibernate了,最近想弄Hibernate4搭建一下环境。

字面意思应该是hibernate不知道的schema里system_sequences表.
于是检查hibernate配置文件hibernate.cfg.xml

发现dialect方言用错了,忘记改过来

org.hibernate.dialect.HSQLDialect

我用的是mysql5,应该用这个

org.hibernate.dialect.MySQLInnoDBDialect

修改后不再报Unknown table ‘system_sequences’ in information_schema错误了。

hibernate所有的方言类都放在org.hibernate.dialect包中,从hibernate4.jar中可以找到这些类。
他们均是 org.hibernate.dialect.Dialect 的子类


错误日志:
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'system_sequences' in information_schema
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3515)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3447)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2548)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2477)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1422)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences(DatabaseMetadata.java:149)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:70)
at org.hibernate.tool.hbm2ddl.DatabaseMetadata.<init>(DatabaseMetadata.java:63)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:196)
at org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:178)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:492)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1784)
at com.hel.util.HibernateUtil.buildSessionFactory(HibernateUtil.java:12)
at com.hel.util.HibernateUtil.<clinit>(HibernateUtil.java:7)
at com.hel.test.EventManager.createAndStoreEvent(EventManager.java:18)
at com.hel.test.EventManager.main(EventManager.java:13)
2013-1-30 17:35:25 org.hibernate.tool.hbm2ddl.SchemaUpdate execute
ERROR: HHH000299: Could not complete schema update

你可能感兴趣的:(java,Hibernate)