openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "KARR, DAVID (ATTCINW)" <dk0...@att.com>
Subject Get "You cannot access the EntityTransaction when using managed transactions." when I implement @Transactional methods with OpenJPA
Date Wed, 16 Dec 2009 16:45:37 GMT
I have an app using Spring 2.5.6, OpenJPA 1.2.1, and WebLogic 10.3.2.  I
specified a JTA datasource in the persistence.xml.  I have a Spring
controller that calls my DAO class which uses the EntityManager.  This
is working ok with respect to transactions.  As my app is only going to
be reading the database, I would think I wouldn't need transactions.
However, because of one problem I'm having with traversing an
association path, I thought I would try to implement a transactional
service layer, and do the association walking within that layer.

So, I added a class with a "@Transactional" method and put that in
between the Controller and the DAO.  Now, I'm seeing the following
exception stack trace:

--------------------
Caused by:
org.springframework.transaction.CannotCreateTransactionException: Could
not open JPA EntityManager for transaction; nested exception is
<openjpa-1.2.1-r752877:753278 nonfatal user error>
org.apache.openjpa.persistence.InvalidStateException: You cannot access
the EntityTransaction when using managed transactions.
	at
org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransaction
Manager.java:375)
	at
org.springframework.transaction.support.AbstractPlatformTransactionManag
er.getTransaction(AbstractPlatformTransactionManager.java:374)
	at
org.springframework.transaction.interceptor.TransactionAspectSupport.cre
ateTransactionIfNecessary(TransactionAspectSupport.java:263)
	at
org.springframework.transaction.interceptor.TransactionInterceptor.invok
e(TransactionInterceptor.java:101)
	at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Ref
lectiveMethodInvocation.java:171)
	at
org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedIntercept
or.intercept(Cglib2AopProxy.java:635)
	at
com.att.ecom.dynamiccontent.service.CatalogService$$EnhancerByCGLIB$$5a7
c3444.retrieveCatalogTree(<generated>)
	at
com.att.ecom.dynamiccontent.content.Content.getCatalog(Content.java:35)
--------------------

Mime
View raw message