Subject Re: problems with OpenJPA
Author miglists
> > Any idea ?
>
> a) You move the transaction boundaries to include also the fetching part
>
> b) You contact OpenJPA developers and tell them to check whether there
> is no bug in handling the result sets in auto-commit case
>
> c) You specify the connection property "defaultHoldable" in the JDBC
URL
> (this will tell JDBC driver to cache all result sets in memory):
>
> <property name="openjpa.ConnectionURL"
> value="jdbc:firebirdsql://localhost/d:/test.fdb?defaultHoldable"/>
>
> Note, options a) and c) are workarounds, and I am pretty sure that
it is
> a bug in OpenJPA, where it does not conform to the JDBC 3.0 auto-commit
> rules.
>
> Roman
>

Thanks for reply Roman.

I think it is a bug only in OpenJPA 1.1.0, because in 1.0.2 works fine.

If i put all in one transaction, fetching and update, the code runs ok
without errors. But the idea was to test the detached entity:
- fetch a list of master into a JTable;
- user can edit some info;
- use want to save the modifications.

The error stay even if i move the fetching part in a transaction .

If i specify the connection property "defaultHoldable" in the JDBC URL
the error is:

Exception in thread "main" <openjpa-1.1.0-r422266:657916 fatal general
error> org.apache.openjpa.persistence.PersistenceException: Unable to
create a second class object proxy for final class "class $Proxy11".
at
org.apache.openjpa.util.ProxyManagerImpl.assertNotFinal(ProxyManagerImpl.java:545)
at
org.apache.openjpa.util.ProxyManagerImpl.generateProxyCollectionBytecode(ProxyManagerImpl.java:514)
at
org.apache.openjpa.util.ProxyManagerImpl.getFactoryProxyCollection(ProxyManagerImpl.java:363)
at
org.apache.openjpa.util.ProxyManagerImpl.copyCollection(ProxyManagerImpl.java:182)
at
org.apache.openjpa.kernel.AttachStrategy.copyCollection(AttachStrategy.java:344)
at
org.apache.openjpa.kernel.AttachStrategy.attachCollection(AttachStrategy.java:321)
at
org.apache.openjpa.kernel.AttachStrategy.replaceList(AttachStrategy.java:359)
at
org.apache.openjpa.kernel.AttachStrategy.attachField(AttachStrategy.java:223)
at
org.apache.openjpa.kernel.VersionAttachStrategy.attach(VersionAttachStrategy.java:161)
at
org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:241)
at
org.apache.openjpa.kernel.AttachManager.attach(AttachManager.java:101)
at
org.apache.openjpa.kernel.BrokerImpl.attach(BrokerImpl.java:3206)
at
org.apache.openjpa.kernel.DelegatingBroker.attach(DelegatingBroker.java:1158)
at
org.apache.openjpa.persistence.EntityManagerImpl.merge(EntityManagerImpl.java:769)
at Main.testMasterUpdate1(Main.java:121)
at Main.main(Main.java:219)
Java Result: 1


I posted also to 'openjpa users' mailing list,

http://n2.nabble.com/OpenJPA-1.1.0-and-Exception%3A-The-result-set-is-closed-td533628.html