is the implementation wrong or my usage of @transactional?
> org.apache.openjpa.persistence.InvalidStateException: This operation cannot be performed while a Transaction is active.
at org.apache.openjpa.kernel.BrokerImpl.close(BrokerImpl.java:4014)
at
org.apache.openjpa.kernel.DelegatingBroker.close(DelegatingBroker.java:
1282)
at
org.apache.openjpa.persistence.EntityManagerImpl.close(EntityManagerImpl.java:
1002)
at
com.wideplay.warp.jpa.EntityManagerFactoryHolder.closeCurrentEntityManager(EntityManagerFactoryHolder.java:
58)
at
com.wideplay.warp.jpa.JpaLocalTxnInterceptor.invoke(JpaLocalTxnInterceptor.java:
61)
JpaLocalTxnInterceptor does commit or rollback the active txn before
trying to close the EM, so I'm not sure what could be wrong from the
information given. There is a potential corner case where txn commit()
throws and exception itself, but there are tests that assure against
this case for Hibernate--not tested with OpenJPA =(
Can you post the offending code (i.e. the method marked
@Transactional) and your module configuration?
Also make sure you are using the latest warp-persist binary, if you
downloaded it from the site.
Dhanji.
first, it tries to join to a active transaction --> ok
the first try/catch/finally starts the transaction txn.begin,
but in this finally block it closes the entitymanager:
} finally {
//close the em if necessary
if (isUnitOfWorkTransaction()) {
EntityManagerFactoryHolder.closeCurrentEntityManager();
}
}
later it commits the transaction
my patch (but im not expert enough ..)
Index: src/com/wideplay/warp/jpa/JpaLocalTxnInterceptor.java
===================================================================
--- src/com/wideplay/warp/jpa/JpaLocalTxnInterceptor.java (revision
60)
+++ src/com/wideplay/warp/jpa/JpaLocalTxnInterceptor.java (working
copy)
@@ -57,7 +57,7 @@
throw e;
} finally {
//close the em if necessary
- if (isUnitOfWorkTransaction()) {
+ if (isUnitOfWorkTransaction() && !txn.isActive()) {
EntityManagerFactoryHolder.closeCurrentEntityManager();
}
}
On Oct 20, 11:08 am, "Dhanji R. Prasanna" <dha...@gmail.com> wrote:
> Hi Adrian
>
> JpaLocalTxnInterceptor does commit or rollback the active txn before
> trying to close the EM, so I'm not sure what could be wrong from the
> information given. There is a potential corner case where txn commit()
> throws and exception itself, but there are tests that assure against
> this case for Hibernate--not tested with OpenJPA =(
>
> Can you post the offending code (i.e. the method marked
> @Transactional) and your module configuration?
>
> Also make sure you are using the latest warp-persist binary, if you
> downloaded it from the site.
>
> Dhanji.
>
Thanks for reporting this!!!
Dhanji.
On 10/20/07, Adrian <space...@gmail.com> wrote:
>
Plz report any errors you find with this or if you would like to
contrib a test for this issue that would be great.
Thanks again for reporting it. This is how we make warp better. =)
Dhanji.