我正在研究 Spring-Hibernate-Websphere 应用程序和 sybase 作为数据库。以下是配置 Spring/Hibernate 以引用 Websphere 的 JNDI 数据源的代码片段。
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/icpDS" />
<property name="lookupOnStartup" value="false" />
<property name="cache" value="true" />
<property name="proxyInterface" value="javax.sql.DataSource" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.ubs.research.icp.hibernate.object" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.max_fetch_depth">${hibernate.max_fetch_depth}</prop>
</props>
</property>
</bean>
<tx:annotation-driven />
<bean id="transactionManager" class="org.springframework.transaction.jta.WebSphereUowTransactionManager"/>
以下是上述代码中使用的属性的值:
hibernate.dialect=org.hibernate.dialect.SybaseDialect
hibernate.show_sql=true
hibernate.format_sql=true
hibernate.connection.autocommit=false
hibernate.max_fetch_depth=0
上面的配置在使用一些简单的查询时工作正常,我可以在控制台上看到那些休眠生成的查询。但是,在执行一些复杂的查询(具有多个连接)时,我发现下面的异常包含异常。
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R Caused by: java.sql.SQLException: JZ0PA: The query has been cancelled and the response discarded. The cancel was probably issued by another statement on the connection.
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at com.sybase.jdbc3.jdbc.SybStatement.getUpdateCount(Unknown Source)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.closeWrapper(WSJdbcPreparedStatement.java:479)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java:240)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcObject.close(WSJdbcObject.java:193)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.jdbc.AbstractBatcher.closePreparedStatement(AbstractBatcher.java:534)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.jdbc.AbstractBatcher.closeStatement(AbstractBatcher.java:269)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:285)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatcher.java:212)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.loader.Loader.doQuery(Loader.java:726)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.loader.Loader.doList(Loader.java:2213)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.loader.Loader.list(Loader.java:2099)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1695)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
[6/25/12 13:31:00:357 EDT] 0000002f SystemErr R at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
什么可能导致此错误?任何指针都非常感谢。