Weblogic中hibernate3異常:
ClassNotFoundException: org.hibernate.hql.ast.HqlToken
Hibernate3.0 採用新的基於ANTLR的HQL/SQL查詢翻譯器,在Hibernate的配置文件中,
1、Hibernate3.0的查詢翻譯器:
hibernate.query.factory_class= org.hibernate.hql.ast.ASTQueryTranslatorFactory
2、Hibernate2.1的查詢翻譯器
hibernate.query.factory_class= org.hibernate.hql.classic.ClassicQueryTranslatorFactory
3.0的批量更新和刪除功能,
(2)可以支持輸入中文,但沒法解釋批量更新語句了
hibernate3中需要用到antlr,然而這個包在weblogic.jar中已經包含了antrl類庫,
出現這個錯誤之後,antlr會調用System.exit(),這樣weblogic就會中止服務。
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:mydb</property>
<property name="connection.username">xxxx</property>
<property name="connection.password">xxxx</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
<mapping resource="xxxxx.hbm.xml" />
</session-factory>
</hibernate-configuration>