-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: DB2 JNDI Datasource issue - result set is closed
PostPosted: Fri Jun 29, 2007 10:03 am 
Newbie

Joined: Thu Jun 28, 2007 5:17 pm
Posts: 2
I've used Hibernate Synchronizer to generate DAO's based on Spring's HibernateTemplate, and all Unit tests run against Derby work correctly, Integration tests with my UDB database using Jakarta Commons DBCP work correctly, and Jakarta Commons DBCP running in my local Websphere AppServer also works correctly. However, when I switch over to use a JNDI Datasource set up in my AppServer, many of my DAO calls that result in mutliple queries to make up the persistent object I get back fail, making it appear that my result set is getting closed before the code is done with it.

Is there anything special I need to set up in my Hibernate properties, when working with a JNDI datasource, that I'm failing to find in the Hibernate documentation and/or on other forum posts for this issue?

<prop key="hibernate.dialect">org.hibernate.dialect.DB2Dialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.use_outer_join">true</prop>
<prop key="hibernate.connection.release_mode">auto</prop>

Hibernate version: 3.2.3

Full stack trace of any exception that occurs:
SQL state [null]; error code [-99999]; [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed.; nested exception is com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed.


Name and version of the database you are using:
UDB 8.1


The generated SQL (show_sql=true):
Hibernate: select customerac0_.USERID as USERID22_, customerac0_.ACCOUNTNUMBER as ACCOUNTN2_22_ from ZIMBUBNK.CUSTOMERACCOUNTS customerac0_ where customerac0_.USERID='test00'

Hibernate: select account0_.ACCOUNTNUMBER as ACCOUNTN1_18_0_, account0_.BALANCE as BALANCE18_0_, account0_.ACCOUNTOWNERSHIPID as ACCOUNTO3_18_0_, account0_.ACCOUNTTYPEID as ACCOUNTT4_18_0_ from ZIMBUBNK.ACCOUNT account0_ where account0_.ACCOUNTNUMBER=?

Hibernate: select accountown0_.ACCOUNTOWNERSHIPTYPEID as ACCOUNTO1_20_0_, accountown0_.ACCOUNTOWNERSHIPTYPE as ACCOUNTO2_20_0_ from ZIMBUBNK.ACCOUNTOWNERSHIPTYPE accountown0_ where accountown0_.ACCOUNTOWNERSHIPTYPEID=?

Hibernate: select accounttyp0_.ACCOUNTTYPEID as ACCOUNTT1_21_0_, accounttyp0_.ACCOUNTTYPE as ACCOUNTT2_21_0_ from ZIMBUBNK.ACCOUNTTYPE accounttyp0_ where accounttyp0_.ACCOUNTTYPEID=?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 2:55 pm 
Newbie

Joined: Thu Jun 28, 2007 5:17 pm
Posts: 2
I have tried everything I can think of, all to no avail:

1) Enabled Container-managed Transactions in Hibernate, using Websphere's JTA transaction lookup:
<prop key="hibernate.transaction.factory_class">
org.hibernate.transaction.CMTTransactionFactory
</prop>
<prop key="hibernate.transaction.manager_lookup_class">
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
</prop>

2) Disabled Container-managed persistence on the WAS Datasource, to have Hibernate use JDBC transactions, and then could try using different connection.release_mode options of on_close or after_transaction, instead of JTA's default of after_statement.

3) Changed LocalSessionFactoryBean definition, to use a hibernate.cfg.xml file, instead of injecting the "dataSource" property into the LocalSessionFactoryBean, in case Hibernate's lookup and management of the Datasource would differ from what LocalSessionFactoryBean does.

None of these work, and all seem to boil down to the same thing: I cannot use my JNDI datasource to loop through a result set, since the result set is getting closed before Hibernate can look up the next item from that result set.

I can use that exact same DB2 driver, either with Jakarta Commons DBCP, or letting Hibernate spin up its own connection pool just fine.

Has anyone else encountered this when working with a Websphere Application Server JNDI Datasource before, and perchance, know of a way to correct it?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.