You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Patrick Linskey (JIRA)" <ji...@apache.org> on 2007/06/16 07:45:25 UTC

[jira] Commented: (OPENJPA-260) Using FetchType.EAGER on OneToMany using jta data source causes result set is closed (DB2)

    [ https://issues.apache.org/jira/browse/OPENJPA-260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505431 ] 

Patrick Linskey commented on OPENJPA-260:
-----------------------------------------

> The work around was to add the eager fetching to the query (i.e. "join fetch x.addresses") 
> but I would think that this should work and might need looking in.

Definitely.

Could you post the SQL that is generated in the two use cases? You can get this by setting the 'openjpa.Log' property to 'SQL=TRACE'.

Also, do you use any other OpenJPA-specific features when executing the query, such as fetch plans?

> Using FetchType.EAGER on OneToMany using jta data source causes result set is closed (DB2)
> ------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-260
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-260
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: jpa
>    Affects Versions: 0.9.7
>         Environment: WebSphere Platform 6.1 [BASE 6.1.0.7 cf70711.17] [WEBSERVICES 6.1.0.7 u0712.14] 
> Host Operating System is Windows XP, version 5.1 build 2600 Service Pack 2
> Java version = J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223ifx-20070323 (JIT enabled)
> J9VM - 20070322_12058_lHdSMR
> JIT  - 20070109_1805ifx3_r8
> GC   - WASIFIX_2007, Java Compiler = j9jit23, Java VM name = IBM J9 VM
>            Reporter: Justin Kilimnik
>            Priority: Minor
>
> When adding "fetch=FetchType.EAGER" to a OneToMany field on an entity, I get a org.apache.openjpa.persistence.PersistenceException: [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed. exception. This is on a persistence unit that is configured to use JTA Data Source (see config below) (running on WebSphere 6.1.0.7 with DB2 XA Driver). This works when using RESOURCE_LOCAL transaction-type (direct to DB2). The code also works if I remove the "fetch=FetchType.EAGER", therefore I presume there is a bug with the handling of managed transactions with EAGER fetching.
> The work around was to add the eager fetching to the query (i.e. "join fetch x.addresses") but I would think that this should work and might need looking in.
> persistence.xml:
> 	<persistence-unit name="crs" transaction-type="JTA">
> 		<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> 		<jta-data-source>java:comp/env/jdbc/crsDS</jta-data-source>
> 		
> 		<class>crs.bus.entity.Customer</class>
>   		<class>crs.bus.entity.Address</class>
> 		<class>crs.bus.entity.CustomerAddress</class>
> 				
> 		<properties>
>  			<property name="openjpa.TransactionMode" value="managed" />
> 			<property name="openjpa.ConnectionFactoryMode" value="managed" />
> 			<property name="openjpa.jdbc.DBDictionary" value="db2" />
> 		</properties>
> Entity:
> @Entity
> @Table(name="Customer", uniqueConstraints={@UniqueConstraint(columnNames="id")})
> public class Customer implements Serializable  {
> 	/** .*/
> 	private static final long serialVersionUID = 4011736633726247664L;
> 	@Id
> 	@GeneratedValue(strategy=GenerationType.IDENTITY)
> 	private long id;
> 	@Basic
> 	private String name;
> 	@OneToMany(cascade={CascadeType.ALL}, fetch=FetchType.EAGER)
> 	private List<CustomerAddress> addresses;
>     @Basic
>     private Date created = new Date();	
> ....
> }
> Exception:
> Caused by: <0.9.7-incubating nonfatal general error> org.apache.openjpa.persistence.PersistenceException: [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed.
> 	at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:3784)
> 	at org.apache.openjpa.jdbc.sql.DB2Dictionary.newStoreException(DB2Dictionary.java:373)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:97)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:83)
> 	at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:59)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:260)
> 	at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:111)
> 	at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
> 	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:876)
> 	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:834)
> 	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:756)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:776)
> 	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:257)
> 	at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2152)
> 	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:251)
> 	at org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:59)
> 	at org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:36)
> 	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1219)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:987)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:796)
> 	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:766)
> 	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:533)
> 	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:227)
> 	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:269)
> 	at crs.bus.impl.query.EntityQueries.queryFromPersonName(EntityQueries.java:18)
> 	at crs.bus.impl.CustomerQueryBean.findByPersonName(CustomerQueryBean.java:39)
> 	at crs.bus.proxies.CustomerQueryProxy.findByPersonName(CustomerQueryProxy.java:15)
> 	at crs.service.servant.CustomerQueryServant.findByPersonName(CustomerQueryServant.java:26)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:615)
> 	at com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatcher.invokeMethod(JavaDispatcher.java:178)
> 	at com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatcher.invokeOperation(JavaDispatcher.java:141)
> 	at com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.processRequestResponse(SoapRPCProcessor.java:448)
> 	at com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.processMessage(SoapRPCProcessor.java:413)
> 	at com.ibm.ws.webservices.engine.dispatchers.BasicDispatcher.processMessage(BasicDispatcher.java:134)
> 	at com.ibm.ws.webservices.engine.dispatchers.java.SessionDispatcher.invoke(SessionDispatcher.java:204)
> 	... 31 more
> Caused by: com.ibm.db2.jcc.c.SqlException: [ibm][db2][jcc][10120][10898] Invalid operation: result set is closed.
> 	at com.ibm.db2.jcc.c.wf.mb(wf.java:3193)
> 	at com.ibm.db2.jcc.c.wf.j(wf.java:3164)
> 	at com.ibm.db2.jcc.c.wf.getTimestamp(wf.java:750)
> 	at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getTimestamp(WSJdbcResultSet.java:1994)
> 	at org.apache.openjpa.lib.jdbc.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:166)
> 	at org.apache.openjpa.jdbc.sql.DBDictionary.getTimestamp(DBDictionary.java:727)
> 	at org.apache.openjpa.jdbc.sql.DBDictionary.getDate(DBDictionary.java:594)
> 	at org.apache.openjpa.jdbc.sql.ResultSetResult.getDateInternal(ResultSetResult.java:303)
> 	at org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetResult.java:384)
> 	at org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:662)
> 	at org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore(HandlerStrategies.java:205)
> 	at org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:172)
> 	at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:788)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:833)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:785)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:336)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:255)
> 	... 63 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.