Hibernate3.0 采用新的基于ANTLR的HQL/SQL查询翻译器,不过,Hibernate2.1的查询翻译器也依然存在。在Hibernate的配置文件中,hibernate.query.factory_class属性用来选择查询翻译器。例如:
(1)选择Hibernate3.0的查询翻译器:
hibernate.query.factory_class= org.hibernate.hql.ast.ASTQueryTranslatorFactory
(2)选择Hibernate2.1的查询翻译器
hibernate.query.factory_class= org.hibernate.hql.classic.ClassicQueryTranslatorFactory
<?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">
<hibernate-configuration>
<session-factory>
<!--
<property name="connection.datasource">EAPT</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@172.29.12.31:1521:eternal</property>
<property name="connection.username">EADB</property>
<property name="connection.password">EADB</property>
-->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@localhost:1521:orcl</property>
<property name="connection.username">EADB</property>
<property name="connection.password">EADB</property>
<property name="dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">false</property>
<property name="hibernate.query.factory_class">
org.hibernate.hql.classic.ClassicQueryTranslatorFactory
</property>
<mapping resource="com/eapt/vo/EaptAdjustftcreceiveheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptAdjustftcreceiveline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptAgentinvoice.hbm.xml" />
<mapping resource="com/eapt/vo/EaptAgentinvoiceline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptArticle.hbm.xml" />
<mapping resource="com/eapt/vo/EaptArticlerate.hbm.xml" />
<mapping resource="com/eapt/vo/EaptBankrecord.hbm.xml" />
<mapping resource="com/eapt/vo/EaptBindarticle.hbm.xml" />
<mapping resource="com/eapt/vo/EaptCargoplace.hbm.xml" />
<mapping resource="com/eapt/vo/EaptCustomer.hbm.xml" />
<mapping resource="com/eapt/vo/EaptCustomeraddress.hbm.xml" />
<mapping resource="com/eapt/vo/EaptCustomerpaymentinfo.hbm.xml" />
<mapping resource="com/eapt/vo/EaptCustomerportion.hbm.xml" />
<mapping resource="com/eapt/vo/EaptCustomerportiontake.hbm.xml" />
<mapping resource="com/eapt/vo/EaptCustomerrecord.hbm.xml" />
<mapping resource="com/eapt/vo/EaptDispatchlistappendline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptDispatchlistheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptDispatchlistline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptDriver.hbm.xml" />
<mapping resource="com/eapt/vo/EaptExchangerate.hbm.xml" />
<mapping resource="com/eapt/vo/EaptExpensecategory.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFee.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFinancialaccount.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFinancialaccount1.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFtcinvoiceheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFtcontractheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFtcontractheader2.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFtcontractheader4.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFtcontractheader5.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFtcontractline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptLc.hbm.xml" />
<mapping resource="com/eapt/vo/EaptNtcontractheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptNtcontractline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPackinglistline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPayment.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPaymentapportion.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPaytax.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPoheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPoline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPrechargenoticeheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptProduct.hbm.xml" />
<mapping resource="com/eapt/vo/EaptReturnheader.hbm.xml" />
<mapping resource="com/eapt/vo/EaptReturnline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptSettleaccount.hbm.xml" />
<mapping resource="com/eapt/vo/EaptShip.hbm.xml" />
<mapping resource="com/eapt/vo/EaptShipmessage.hbm.xml" />
<mapping resource="com/eapt/vo/EaptStock.hbm.xml" />
<mapping resource="com/eapt/vo/EaptStockin.hbm.xml" />
<mapping resource="com/eapt/vo/EaptStockinline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptStockout.hbm.xml" />
<mapping resource="com/eapt/vo/EaptStockoutline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptTransfer.hbm.xml" />
<mapping resource="com/eapt/vo/EaptTransferline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptVatinvoice.hbm.xml" />
<mapping resource="com/eapt/vo/EaptVatinvoiceline.hbm.xml" />
<mapping resource="com/eapt/vo/Employee.hbm.xml" />
<mapping resource="com/eapt/vo/Operationhistory.hbm.xml" />
<mapping resource="com/eapt/vo/PubConstant.hbm.xml" />
<mapping resource="com/eapt/vo/Ratehi.hbm.xml" />
<mapping resource="com/eapt/vo/Sequencescan.hbm.xml" />
<mapping resource="com/eapt/vo/PubPermission.hbm.xml" />
<mapping resource="com/eapt/vo/PubPermissioncategory.hbm.xml" />
<mapping resource="com/eapt/vo/PubPermissionset.hbm.xml" />
<mapping resource="com/eapt/vo/EaptAudit.hbm.xml" />
<mapping resource="com/eapt/vo/EaptMessage.hbm.xml" />
<mapping resource="com/eapt/vo/EaptDBNotes.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPayFee.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPayFeeline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptRelationdoc.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPoVatInvoice.hbm.xml" />
<mapping resource="com/eapt/vo/EaptPoVatInvoiceline.hbm.xml" />
<mapping resource="com/eapt/vo/EaptFinancialpaymentcustomer.hbm.xml" />
<mapping resource="com/eapt/vo/EaptArrearage.hbm.xml" />
<mapping resource="com/eapt/vo/EaptVerificationsheet.hbm.xml" />
</session-factory>
</hibernate-configuration>