最近在项目中用weblogic跑Spring+hibernate的运用(在websphere中正常运行)
抛出如下的异常
org.springframework.orm.hibernate3.HibernateQueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from com.datastage.model.TmdDatastageXm project where project.jqbh=?]; nested exception is org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from com.datastage.model.TmdDatastageXm project where project.jqbh=?]org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from com.datastage.model.TmdDatastageXm project where project.jqbh=?]
at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:57)
at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(HqlLexer.java:31)
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
- <prop key="hibernate.show_sql">false</prop>
- <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
- </props>
- </property>
在配置中加以下属性就可以解决
<prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
- <prop key="hibernate.show_sql">false</prop>
- <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
- <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
- </props>
- </property>
本文介绍了一种在Spring+Hibernate项目中遇到的HQL查询异常问题及其解决方案。该异常主要表现为ClassNotFoundException,通过调整Hibernate的查询解析器配置解决了问题。
1288

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



