Table not found in statement [select sequence_name from system_sequences]

错误:用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.<init>(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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值