Hello,
I got the following exception when I migrate my code from hibernate 2.1.8 to hibernate 3.0.5 (Spring framework in middle tier 1.2.3). The exception happens when I do batchupdate:
Sample code :
ScrollableResults myapps=
session.getNamedQuery("abc")
.setParameterList("products", products)
.scroll(ScrollMode.FORWARD_ONLY);
int count=0;
while ( myapps.next() ) {
Product p = (Product) applications.get(0);
p.setName("test1");
if ( ++count % BATCH_SIZE == 0 ) {
session.flush();
session.clear();
}
Hibernate version:3.0.5
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
[08-30 17:34:08] JtaTransactionManager.java:734 - Committing JTA transaction
[08-30 17:34:08] AbstractPlatformTransactionManager.java:692 - Triggering afterC
ompletion synchronization
[08-30 17:34:08] SessionFactoryUtils.java:773 - Closing Hibernate Session
[08-30 17:34:08] AbstractBatcher.java:313 - about to close ResultSet (open Resul
tSets: 1, globally: 1)
[08-30 17:34:08] AbstractBatcher.java:208 - exception clearing maxRows/queryTime
out
java.sql.SQLException: Statement has already been closed
at weblogic.jdbc.wrapper.Statement.checkStatement(Statement.java:231)
at weblogic.jdbc.wrapper.Statement.preInvocationHandler(Statement.java:8
3)
at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_T4CPrepare
dStatement.getMaxRows(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.closeQueryStatement(AbstractBatche
r.java:204)
at org.hibernate.jdbc.AbstractBatcher.closeStatements(AbstractBatcher.ja
va:254)
at org.hibernate.jdbc.ConnectionManager.cleanup(ConnectionManager.java:2
59)
at org.hibernate.jdbc.ConnectionManager.close(ConnectionManager.java:194
)
at org.hibernate.impl.SessionImpl.close(SessionImpl.java:289)
at org.springframework.orm.hibernate3.SessionFactoryUtils.doClose(Sessio
nFactoryUtils.java:775)
at org.springframework.orm.hibernate3.SessionFactoryUtils.closeSessionOr
RegisterDeferredClose(SessionFactoryUtils.java:764)
at org.springframework.orm.hibernate3.SessionFactoryUtils.access$100(Ses
sionFactoryUtils.java:86)
at org.springframework.orm.hibernate3.SessionFactoryUtils$SpringSessionS
ynchronization.afterCompletion(SessionFactoryUtils.java:957)
at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:724)
at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:696)
at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.processCommit(AbstractPlatformTransactionManager.java:533)
at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.commit(AbstractPlatformTransactionManager.java:468)
at org.springframework.transaction.interceptor.TransactionAspectSupport.
doCommitTransactionAfterReturning(TransactionAspectSupport.java:258)
at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:144)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:174)
Name and version of the database you are using: Oracle 9i
|