Hello hibernate people, just a small problem that is leaving me scratching my head.
Environment:Code:
Hibernate 3.3.1
Spring 2.5.6
DB2 v9 running on zOs
Websphere 6.1.0.23
I'm getting this error while using DetachedCriteria and HibernateTemplate:Code:
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [select this_.MBR_ID as MBR1_25_0_, this_.CUST_ID as CUST2_25_0_, this_.CLNT_ID as CLNT3_25_0_, this_.PRESBR_ID as PRESBR4_25_0_, this_.PRES_ELIG_EFFV_DTE as PRES5_25_0_, this_.PRES_ELIG_TERM_DTE as PRES6_25_0_ from ARGRX2.PRESBR_ELIGY_LCK this_ where this_.CUST_ID=? and this_.CLNT_ID=? and this_.MBR_ID=? and this_.PRES_ELIG_TERM_DTE>?]; SQL state [null]; error code [-99999]; [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed.; nested exception is com.ibm.db2.jcc.b.SqlException: [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed.
Relavent DAO code. The exception is thrown on the return statement:Code:
DetachedCriteria criteria = DetachedCriteria.forClass(PrescriberLock.class);
criteria.add(Restrictions.eq("id.prescriber.customerId", member.getCustomerId()));
criteria.add(Restrictions.eq("id.prescriber.clientId", member.getClientId()));
criteria.add(Restrictions.eq("id.mbrId", member.getMemberId()));
criteria.add(Restrictions.gt("terminationDate", new Date()));
return getHibernateTemplate().findByCriteria(criteria);
Complete stack Trace:Code:
Caused by: com.ibm.db2.jcc.b.SqlException: [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed.
at com.ibm.db2.jcc.b.hh.pb(hh.java:3398)
at com.ibm.db2.jcc.b.hh.a(hh.java:1365)
at com.ibm.db2.jcc.b.hh.getDate(hh.java:1194)
at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getDate(WSJdbcResultSet.java:1149)
at org.hibernate.type.DateType.get(DateType.java:51)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:184)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:173)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2124)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1404)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332)
at org.hibernate.loader.Loader.getRow(Loader.java:1230)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:603)
at org.hibernate.loader.Loader.doQuery(Loader.java:724)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2228)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:118)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1596)
at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:306)
at org.springframework.orm.hibernate3.HibernateTemplate$36.doInHibernate(HibernateTemplate.java:1065)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419)
... 16 more
Temporary Solution:I found this on IBM's website:
Quote:
Troubleshoot issues with closed cursors.
The following is an exception from DB2 in the log org.apache.openjpa.persistence.PersistenceException:
[ibm][db2][jcc][10120][10898] Invalid operation: result set is closed
By default, the application server configures the resultSetHoldability custom property with a value of 2 (CLOSE_CURSORS_AT_COMMIT). This property causes DB2 to close its resultSet/cursor at transaction boundaries. Despite DB2's default resultSetHoldability value of 1 (HOLD_CURSORS_OVER_COMMIT), the application server retains the default value if 2 to avoid breaking compatibilities with previous releases of the application server. You can change the default if the need arises.
http://publib.boulder.ibm.com/infocente ... shoot.htmlThis works. Why though? We haven't had to do this on any other application connection to this database. We're scratching our heads.
Thanks for any help, hints, thoughts, theories, or input.
Update: some interesting info from the Websphere Log:Quote:
O [2009-07-28 09:55:30,131] WARN JDBCExceptionReporter - SQL Error: -99999, SQLState: null
[7/28/09 9:55:30:131 CDT] 00000027 SystemOut O [2009-07-28 09:55:30,131] ERROR JDBCExceptionReporter - Invalid operation: result set closed
[7/28/09 9:55:30:209 CDT] 00000027 SharedPool I J2CA0086W: Shareable connection MCWrapper id 296e296e Managed connection WSRdbManagedConnectionImpl@1e041e04 State:STATE_TRAN_WRAPPER_INUSE
from resource jdbc/MemberServicesWSDBMF was used within a local transaction containment boundary.
[7/28/09 9:55:30:256 CDT] 00000023 SystemOut O [2009-07-28 09:55:30,224] ERROR DefaultFaultHandler - Fault occurred!
We are using a workmanager to kick multiple queries off to the database, however, each work item has a separate datasource. I'm researching if this has an effect.