Table not found in statement [select sequence_name from system_sequences]

最近做一个项目,要用到hibernate和内嵌HSQL数据库,不过总是出问题,在网上搜到了解决方法,特转来收藏 错误:用hibernate配置文件生成数据库Schema。设置hbm2ddl = update,启动JBoss时报错误Table not found in statement [select sequence_name from system_sequences]。如果去掉这条,则启动没问题。 HSQLDB版本:1.8.0.10 Hibernate版本:3.0.5 JBoss版本:4.2.3GA 详细错误: === stack trace === INFO [main] SchemaUpdate - Running hbm2ddl schema update INFO [main] SchemaUpdate - fetching database metadata ERROR [main] SchemaUpdate - could not get database metadata java.sql.SQLException: Table not found in statement [select sequence_name from system_sequences] org.hsqldb.jdbc.Util.sqlException(Unknown Source) org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source) org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source) org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences (DatabaseMetadata.java:113) org.hibernate.tool.hbm2ddl.DatabaseMetadata. (DatabaseMetadata.java:39) org.hibernate.tool.hbm2ddl.SchemaUpdate.execute(SchemaUpdate.java:124) 原因:hibernate dialect 和 hsqldb 之间的问题 参考:http://203.208.39.132/search?q=cache:1CqIddxsEKYJ:opensource.atlassian.com/projects/hibernate/browse/HHH-608%3Fpage%3Dcom.atlassian.jira.plugin.system.issuetabpanels%253Achangehistory-tabpanel+at+org.hibernate.tool.hbm2ddl.DatabaseMetadata.initSequences&cd=10&hl=zh-CN&ct=clnk&gl=cn&st_usg=ALhdy28ExWKmEvcPvdosBtFP01uoylQ4RQ(这是google缓存页,源地址如下,但打不开) [http://opensource.atlassian.com/projects/hibernate/browse/HHH-608?page=com.atlassian.jira.plugin.system.issuetabpanels%3Achangehistory-tabpanel] 解决:hibernate升到3.2.5GA 后续问题:Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cfg/HbmBinder$SecondPass 描述:看似是缺少包,但检查过有这个Class 原因:包冲突,刚才删除hibernate 3.0.5时,仅仅删除了hibernate3.jar,还有hibernate-annotations.jar也要删除 解决:删除hibernate-annotations.jar 参考:http://wvvw3.javaeye.com/blog/125120

你可能感兴趣的:(Hibernate,jboss,table,System,HSQLDB,initialization)