openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo K. Shikida" <shik...@gmail.com>
Subject Re: PersistenceException while trying to save class with composite primary key (@EmbeddedId/@Embeddable)
Date Thu, 21 Nov 2013 15:46:34 GMT
tomee 1.5.2 = openJPA 2.2.0
tomee 1.6.0 = openJPA 2.3.0-Snapshot

thanks!

Leo

[]

Leo


On Thu, Nov 21, 2013 at 1:17 PM, Rick Curtis <curtisr7@gmail.com> wrote:

> Do you know what version of OpenJPA is in  TomeEE 1.5.2?
>
>
> On Wed, Nov 20, 2013 at 6:46 PM, Leonardo K. Shikida <shikida@gmail.com
> >wrote:
>
> > Hi
> >
> > My code that was working with tomee 1.5.2 (openEJB 4.5.2 I guess).
> >
> > Now I am trying to use tomee 1.6.0 (openEJB 4.6.0 I guess again).
> >
> > My class uses a primary key following this structure
> >
> > @Entity
> > public class UserGroupAccess implements Serializable{
> >
> >     /**
> >      *
> >      */
> >     private static final long serialVersionUID = 7233673815582184369L;
> >
> >     @ManyToOne
> >     @JoinColumn(name="applicationId")
> >     @MapsId("applicationId")
> >     private Application application;
> >
> >     @ManyToOne
> >     @JoinColumn(name="securityLevelId")
> >     @MapsId("securityLevelId")
> >     private SecurityLevel securityLevel;
> >
> >     @ManyToOne
> >     @JoinColumn(name="userId")
> >     @MapsId("userId")
> >     private User user;
> >
> >     @EmbeddedId
> >     private UserGroupAccessPK pk;
> > (...)
> > }
> >
> > and the primary key
> >
> > @Embeddable
> > public class UserGroupAccessPK implements Serializable{
> >
> >     /**
> >      *
> >      */
> >     private static final long serialVersionUID = 7233673815582184369L;
> >
> >     public UserGroupAccessPK(long application,
> >             long securityLevel, long user) {
> >         super();
> >         this.applicationId = application;
> >         this.securityLevelId = securityLevel;
> >         this.userId = user;
> >     }
> >
> >     public UserGroupAccessPK() {
> >         super();
> >     }
> >
> >     private long applicationId;
> >
> >     private long securityLevelId;
> >
> >     private long userId;
> > (...)
> > }
> >
> > These classes are enhanced manually with
> > org.apache.openjpa.enhance.PCEnhancer
> >
> > While trying to run some tests, I've got the following exception
> >
> > INFO: Starting OpenJPA 2.3.0-SNAPSHOT
> > Nov 20, 2013 10:31:32 PM null
> > INFO: Connected to Oracle version 11.11 using JDBC driver Oracle JDBC
> > driver version 12.1.0.1.0.
> > Nov 20, 2013 10:31:39 PM
> > org.apache.geronimo.transaction.manager.TransactionImpl beforeCompletion
> > WARNING: Unexpected exception from beforeCompletion; transaction will
> roll
> > back
> > <openjpa-2.3.0-SNAPSHOT-r422266:1535082 nonfatal general error>
> > org.apache.openjpa.persistence.PersistenceException:
> > org.apache.openjpa.kernel.DetachedStateManager cannot be cast to
> > org.apache.openjpa.kernel.StateManagerImpl
> >     at
> >
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2027)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:527)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:512)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:413)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:262)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)
> >     at
> >
> >
> org.apache.openejb.core.transaction.JtaTransactionPolicy.completeTransaction(JtaTransactionPolicy.java:328)
> >     at
> > org.apache.openejb.core.transaction.TxRequired.commit(TxRequired.java:75)
> >     at
> >
> >
> org.apache.openejb.core.transaction.EjbTransactionUtil.afterInvoke(EjbTransactionUtil.java:76)
> >     at
> >
> >
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:231)
> >     at
> >
> >
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:181)
> >     at
> >
> >
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:272)
> >     at
> >
> >
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:267)
> >     at
> >
> >
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:90)
> >     at
> >
> >
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:306)
> > Caused by: java.lang.ClassCastException:
> > org.apache.openjpa.kernel.DetachedStateManager cannot be cast to
> > org.apache.openjpa.kernel.StateManagerImpl
> >     at
> >
> >
> org.apache.openjpa.jdbc.meta.FieldMapping.setPKValueFromMappedByIdField(FieldMapping.java:640)
> >     at
> > org.apache.openjpa.jdbc.meta.FieldMapping.insert(FieldMapping.java:622)
> >     at
> >
> >
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.insert(AbstractUpdateManager.java:239)
> >     at
> >
> >
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.populateRowManager(AbstractUpdateManager.java:166)
> >     at
> >
> >
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:110)
> >     at
> >
> >
> org.apache.openjpa.jdbc.kernel.AbstractUpdateManager.flush(AbstractUpdateManager.java:78)
> >     at
> >
> >
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.flush(JDBCStoreManager.java:732)
> >     at
> >
> >
> org.apache.openjpa.kernel.DelegatingStoreManager.flush(DelegatingStoreManager.java:131)
> >     at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2203)
> >     at
> org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2101)
> >     at
> >
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2019)
> >     ... 17 more
> >
> > Exception in thread "main" javax.ejb.EJBTransactionRolledbackException:
> > Transaction was rolled back, presumably because setRollbackOnly was
> called
> > during a synchronization
> >     at
> >
> >
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:379)
> >     at
> >
> >
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:310)
> > Caused by: javax.transaction.RollbackException: Unable to commit:
> > transaction marked for rollback
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:272)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252)
> >     at
> >
> >
> org.apache.openejb.core.transaction.JtaTransactionPolicy.completeTransaction(JtaTransactionPolicy.java:328)
> >     at
> > org.apache.openejb.core.transaction.TxRequired.commit(TxRequired.java:75)
> >     at
> >
> >
> org.apache.openejb.core.transaction.EjbTransactionUtil.afterInvoke(EjbTransactionUtil.java:76)
> >     at
> >
> >
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:231)
> >     at
> >
> >
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:181)
> >     at
> >
> >
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:272)
> >     at
> >
> >
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:267)
> >     at
> >
> >
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:90)
> >     at
> >
> >
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:306)
> >     ... 3 more
> > Caused by:
> > org.apache.geronimo.transaction.manager.SetRollbackOnlyException:
> > setRollbackOnly() called.  See stacktrace for origin
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.setRollbackOnly(TransactionImpl.java:126)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionManagerImpl.setRollbackOnly(TransactionManagerImpl.java:243)
> >     at
> >
> >
> org.apache.openejb.core.TransactionSynchronizationRegistryWrapper.setRollbackOnly(TransactionSynchronizationRegistryWrapper.java:71)
> >     at
> >
> >
> org.apache.openjpa.ee.RegistryManagedRuntime$TransactionManagerRegistryFacade.setRollbackOnly(RegistryManagedRuntime.java:128)
> >     at
> >
> >
> org.apache.openjpa.ee.RegistryManagedRuntime.setRollbackOnly(RegistryManagedRuntime.java:74)
> >     at
> >
> >
> org.apache.openjpa.ee.AutomaticManagedRuntime.setRollbackOnly(AutomaticManagedRuntime.java:274)
> >     at
> >
> >
> org.apache.openjpa.kernel.BrokerImpl.setRollbackOnlyInternal(BrokerImpl.java:1670)
> >     at
> >
> org.apache.openjpa.kernel.BrokerImpl.setRollbackOnly(BrokerImpl.java:1650)
> >     at
> >
> >
> org.apache.openjpa.kernel.DelegatingBroker.setRollbackOnly(DelegatingBroker.java:981)
> >     at
> >
> >
> org.apache.openjpa.persistence.EntityManagerImpl.setRollbackOnly(EntityManagerImpl.java:631)
> >     at
> >
> >
> org.apache.openjpa.persistence.PersistenceExceptions$2.translate(PersistenceExceptions.java:77)
> >     at
> >
> >
> org.apache.openjpa.kernel.BrokerImpl.translateManagedCompletionException(BrokerImpl.java:2089)
> >     at
> >
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:2027)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:527)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.beforeCompletion(TransactionImpl.java:512)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.beforePrepare(TransactionImpl.java:413)
> >     at
> >
> >
> org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:262)
> >     ... 13 more
> >
> > Any help is welcome.
> >
> > Thanks in advance.
> >
> > Leo
> >
>
>
>
> --
> *Rick Curtis*
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message