openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Sutter <kwsut...@gmail.com>
Subject Re: InvalidStateException
Date Tue, 12 Mar 2013 16:24:15 GMT
Hi Jose,
I need to back up to your specific scenario...  Why are you calling
merge()?  To force an update?  The merge() method is not used to force an
update.  The merge() method is used to merge an entity into your
persistence context.  If the merged entity is a detached entity, it will
now be managed by the persistence context so that any changes will
eventually get pushed out to the database.  If the merged entity is a new
entity, then this entity will eventually get inserted into the database
(acts like a persist).  Since you are using @GeneratedValues, then in this
latter case, the new entity would not have an ID value filled in yet.

If your entity is already managed and part of the current persistence
context, then there is no need to call merge().  Any updates to that entity
will automatically be determined and committed to the database when the
transaction completes.

And, in one of your replies, you mention this process:
>  FYI, if i create an object (new operator) with an existent id (in
database),change some field and then call my ejb for merge operation, this
works great.

So, I'm confused on your scenario and what the expected result should be...

Kevin

On Mon, Mar 11, 2013 at 4:33 PM, José Luis Cetina <maxtorzito@gmail.com>wrote:

> Anyone?
>
>
> 2013/3/11 José Luis Cetina <maxtorzito@gmail.com>
>
> > I tried now with 2.2.1 and the same result. With this is impossible to
> > edit any entity.
> >
> > Some advice?
> >
> >
> > 2013/3/11 José Luis Cetina <maxtorzito@gmail.com>
> >
> >> I added and get the same exception:
> >>
> >> <openjpa-2.2.0-r422266:1244990 nonfatal user error>
> >> org.apache.openjpa.persistence.InvalidStateException: Primary key field
> >> com.grupokx.model.core.MyClass.idTest of
> >> com.grupokx.model.core.MyClass@28e0f7f6 has non-default value. The
> >> instance life cycle is in PNewState state and hence an existing
> non-default
> >> value for the identity field is not permitted. You either need to remove
> >> the @GeneratedValue annotation or modify the code to remove the
> initializer
> >> processing.
> >>  at
> >> org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:489)
> >> at
> org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:469)
> >>  at
> >>
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:740)
> >> at
> >>
> org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:135)
> >>  at
> >>
> org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:612)
> >> at
> >>
> org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2977)
> >>  at org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:40)
> >> at
> >>
> org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:1054)
> >>  at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2112)
> >> at org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2072)
> >>  at
> >>
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1990)
> >> 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.CoreUserTransaction.commit(CoreUserTransaction.java:57)
> >> at
> >>
> org.apache.openejb.core.transaction.EjbUserTransaction.commit(EjbUserTransaction.java:37)
> >>  at
> >>
> org.apache.openejb.core.BaseContext$UserTransactionWrapper.commit(BaseContext.java:247)
> >> at
> >>
> com.grupokx.businesslayer.ejbs.examenesdiagnostico.ExamenesAplicadosFacade.editarBDTest(ExamenesAplicadosFacade.java:277)
> >>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>  at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> at java.lang.reflect.Method.invoke(Method.java:601)
> >>  at
> >>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
> >> at
> >>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
> >>  at
> org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:130)
> >> at
> >> org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:43)
> >>  at org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:67)
> >> at
> >>
> org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:73)
> >>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>  at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> at java.lang.reflect.Method.invoke(Method.java:601)
> >>  at
> >>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
> >> at
> >>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
> >>  at
> >>
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:180)
> >> at
> >>
> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:99)
> >>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >> at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>  at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >> at java.lang.reflect.Method.invoke(Method.java:601)
> >>  at
> >>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
> >> at
> >>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
> >>  at
> >>
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
> >> at
> >>
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:233)
> >>  at
> >>
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:185)
> >> at
> >>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:256)
> >>  at
> >>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:251)
> >> at
> >>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:85)
> >>  at
> >>
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:279)
> >> at $Proxy220.editarBDTest(Unknown Source)
> >>  at
> >>
> com.grupokx.examenesdiagnostico.controller.examenes.ExamenesIndexMBean.onCellEdit(ExamenesIndexMBean.java:148)
> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>  at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >> at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>  at java.lang.reflect.Method.invoke(Method.java:601)
> >> at
> >>
> org.apache.webbeans.intercept.InterceptorHandler.invoke(InterceptorHandler.java:322)
> >>  at
> >>
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:117)
> >> at
> >>
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:108)
> >>  at
> >>
> com.grupokx.examenesdiagnostico.controller.examenes.ExamenesIndexMBean_$$_javassist_52.onCellEdit(ExamenesIndexMBean_$$_javassist_52.java)
> >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> >>  at
> >>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >> at
> >>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>  at java.lang.reflect.Method.invoke(Method.java:601)
> >> at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
> >>  at
> >> org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
> >> at
> >>
> org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96)
> >>  at
> >>
> org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processArgListener(AjaxBehaviorListenerImpl.java:56)
> >> at
> >>
> org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:47)
> >>  at
> >>
> org.primefaces.event.CellEditEvent.processListener(CellEditEvent.java:55)
> >> at
> >>
> javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:74)
> >>  at
> >>
> javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:407)
> >> at javax.faces.component.UIData.broadcast(UIData.java:1610)
> >>  at javax.faces.component.UIData.broadcast(UIData.java:1596)
> >> at javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1028)
> >>  at
> javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:286)
> >> at javax.faces.component.UIViewRoot._process(UIViewRoot.java:1375)
> >>  at
> >> javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
> >> at
> >>
> org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:38)
> >>  at
> >>
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
> >> at
> >>
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
> >>  at
> >>
> org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
> >> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
> >>  at
> >>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> >> at
> >>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> >>  at
> >>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
> >> at
> >>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
> >>  at org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
> >> at
> >>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
> >>  at
> >>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
> >> at
> >>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
> >>  at
> >>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> >> at
> >>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> >>  at
> >>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
> >> at
> >>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
> >>  at
> >>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
> >> at
> >>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> >>  at
> >>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> >> at java.lang.Thread.run(Thread.java:722)
> >>
> >>
> >> 2013/3/11 José Luis Cetina <maxtorzito@gmail.com>
> >>
> >>> Ok, i will try.
> >>>
> >>> FYI, if i create an object (new operator) with an existent id (in
> >>> database),change some field and then call my ejb for merge operation,
> this
> >>> works great.
> >>>
> >>> I will add version filed right now.
> >>>
> >>>
> >>> 2013/3/11 Rick Curtis <curtisr7@gmail.com>
> >>>
> >>>> Just for giggles, could you try adding a version field to your Entity?
> >>>>
> >>>>
> >>>> On Mon, Mar 11, 2013 at 2:42 PM, José Luis Cetina <
> maxtorzito@gmail.com
> >>>> >wrote:
> >>>>
> >>>> > Im using OpenJPA 2.2.0 + enhancement  with Apache TomEE
> >>>> >
> >>>> >
> >>>> > 2013/3/11 José Luis Cetina <maxtorzito@gmail.com>
> >>>> >
> >>>> > > Im using OpenJPA 2.2.0 9 enhancement  with Apache TomEE
> >>>> > >
> >>>> > >
> >>>> > > 2013/3/11 José Luis Cetina <maxtorzito@gmail.com>
> >>>> > >
> >>>> > >> Here it is:
> >>>> > >>
> >>>> > >> WARNING - Unexpected exception from beforeCompletion;
transaction
> >>>> will
> >>>> > >> roll back
> >>>> > >> <openjpa-2.2.0-r422266:1244990 nonfatal user error>
> >>>> > >> org.apache.openjpa.persistence.InvalidStateException:
Primary key
> >>>> field
> >>>> > >> com.grupokx.model.core.MyClass.idTest of
> >>>> > >> com.grupokx.model.core.MyClass@198e0705 has non-default
value.
> The
> >>>> > >> instance life cycle is in PNewState state and hence an
existing
> >>>> > non-default
> >>>> > >> value for the identity field is not permitted. You either
need to
> >>>> remove
> >>>> > >> the @GeneratedValue annotation or modify the code to remove
the
> >>>> > initializer
> >>>> > >> processing.
> >>>> > >>  at
> >>>> > >>
> >>>> org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:489)
> >>>> > >> at
> >>>> >
> org.apache.openjpa.util.ApplicationIds.assign(ApplicationIds.java:469)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.jdbc.kernel.JDBCStoreManager.assignObjectId(JDBCStoreManager.java:740)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.DelegatingStoreManager.assignObjectId(DelegatingStoreManager.java:135)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.StateManagerImpl.assignObjectId(StateManagerImpl.java:612)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.StateManagerImpl.preFlush(StateManagerImpl.java:2977)
> >>>> > >>  at
> >>>> org.apache.openjpa.kernel.PNewState.beforeFlush(PNewState.java:40)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.StateManagerImpl.beforeFlush(StateManagerImpl.java:1054)
> >>>> > >>  at
> >>>> org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:2112)
> >>>> > >> at
> >>>> org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2072)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openjpa.kernel.BrokerImpl.beforeCompletion(BrokerImpl.java:1990)
> >>>> > >> 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.CoreUserTransaction.commit(CoreUserTransaction.java:57)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.transaction.EjbUserTransaction.commit(EjbUserTransaction.java:37)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.BaseContext$UserTransactionWrapper.commit(BaseContext.java:247)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> com.grupokx.businesslayer.ejbs.examenesdiagnostico.ExamenesAplicadosFacade.editarBDTest(ExamenesAplicadosFacade.java:277)
> >>>> > >>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>>> > >> at java.lang.reflect.Method.invoke(Method.java:601)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
> >>>> > >>  at
> >>>> >
> org.apache.openejb.cdi.CdiInterceptor.invoke(CdiInterceptor.java:130)
> >>>> > >> at
> >>>> > >>
> >>>>
> org.apache.openejb.cdi.CdiInterceptor.access$000(CdiInterceptor.java:43)
> >>>> > >>  at
> >>>> org.apache.openejb.cdi.CdiInterceptor$1.call(CdiInterceptor.java:67)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.cdi.CdiInterceptor.aroundInvoke(CdiInterceptor.java:73)
> >>>> > >>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>>> > >> at java.lang.reflect.Method.invoke(Method.java:601)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:180)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:99)
> >>>> > >>  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>>> > >> at java.lang.reflect.Method.invoke(Method.java:601)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:181)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:163)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:138)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:233)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:185)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:256)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:251)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:85)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:279)
> >>>> > >> at $Proxy219.editarBDTest(Unknown Source)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> com.grupokx.examenesdiagnostico.controller.examenes.ExamenesIndexMBean.onCellEdit(ExamenesIndexMBean.java:146)
> >>>> > >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>>> > >>  at java.lang.reflect.Method.invoke(Method.java:601)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.webbeans.intercept.InterceptorHandler.invoke(InterceptorHandler.java:322)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:117)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:108)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> com.grupokx.examenesdiagnostico.controller.examenes.ExamenesIndexMBean_$$_javassist_52.onCellEdit(ExamenesIndexMBean_$$_javassist_52.java)
> >>>> > >> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> >>>> > >>  at java.lang.reflect.Method.invoke(Method.java:601)
> >>>> > >> at org.apache.el.parser.AstValue.invoke(AstValue.java:278)
> >>>> > >>  at
> >>>> > >>
> >>>>
> org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:274)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.myfaces.view.facelets.el.ContextAwareTagMethodExpression.invoke(ContextAwareTagMethodExpression.java:96)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processArgListener(AjaxBehaviorListenerImpl.java:56)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.primefaces.component.behavior.ajax.AjaxBehaviorListenerImpl.processAjaxBehavior(AjaxBehaviorListenerImpl.java:47)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.primefaces.event.CellEditEvent.processListener(CellEditEvent.java:55)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> javax.faces.component.behavior.BehaviorBase.broadcast(BehaviorBase.java:74)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:407)
> >>>> > >> at javax.faces.component.UIData.broadcast(UIData.java:1610)
> >>>> > >>  at javax.faces.component.UIData.broadcast(UIData.java:1596)
> >>>> > >> at
> >>>> javax.faces.component.UIViewRoot._broadcastAll(UIViewRoot.java:1028)
> >>>> > >>  at
> >>>> >
> javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:286)
> >>>> > >> at
> javax.faces.component.UIViewRoot._process(UIViewRoot.java:1375)
> >>>> > >>  at
> >>>> > >>
> >>>>
> javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:752)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:38)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:170)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.myfaces.extensions.cdi.jsf2.impl.listener.phase.CodiLifecycleWrapper.execute(CodiLifecycleWrapper.java:95)
> >>>> > >> at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
> >>>> > >>  at
> >>>> org.apache.tomee.catalina.OpenEJBValve.invoke(OpenEJBValve.java:45)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:581)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
> >>>> > >> at
> >>>> > >>
> >>>> >
> >>>>
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> >>>> > >>  at
> >>>> > >>
> >>>> >
> >>>>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> >>>> > >> at java.lang.Thread.run(Thread.java:722)
> >>>> > >>
> >>>> > >>
> >>>> > >> 2013/3/11 Rick Curtis <curtisr7@gmail.com>
> >>>> > >>
> >>>> > >>> Can you please post the entire stack trace?
> >>>> > >>>
> >>>> > >>>
> >>>> > >>> On Mon, Mar 11, 2013 at 2:23 PM, José Luis Cetina
<
> >>>> > maxtorzito@gmail.com
> >>>> > >>> >wrote:
> >>>> > >>>
> >>>> > >>> > Hi, i have problems trying to use merge method.
> >>>> > >>> >
> >>>> > >>> > I have this scenerio.
> >>>> > >>> >
> >>>> > >>> > 1. My Managedbean get a list of Object  (MyClass)
those
> objects
> >>>> are
> >>>> > in
> >>>> > >>> the
> >>>> > >>> > database, the ejb use a Criteria to get all records.
> >>>> > >>> >
> >>>> > >>> > 2. The managedbean change some property (like
description) in
> >>>> one of
> >>>> > >>> the
> >>>> > >>> > detached entities (that i get from the list).
> >>>> > >>> >
> >>>> > >>> > 3. The managedbean call a EJB and in the EJB
i try to use
> merge
> >>>> for
> >>>> > >>> update
> >>>> > >>> > propuses. Then i get this exception:
> >>>> > >>> >  org.apache.openjpa.persistence.InvalidStateException:
Primary
> >>>> key
> >>>> > >>> field
> >>>> > >>> > com.test.MyClass.id of com.test.MyClass.id 652eb3bd
has
> >>>> non-default
> >>>> > >>> value.
> >>>> > >>> > The instance life cycle is in PNewState state
and hence an
> >>>> existing
> >>>> > >>> > non-default value for the identity field is not
permitted. You
> >>>> either
> >>>> > >>> need
> >>>> > >>> > to
> >>>> > >>> > remove the @GeneratedValue annotation or modify
the code to
> >>>> remove
> >>>> > the
> >>>> > >>> > initializer processing.
> >>>> > >>> >
> >>>> > >>> > I dont know why this error is happens, the id
of the object is
> >>>> the
> >>>> > >>> same id
> >>>> > >>> > that i get when i do the query in the EJB, that
id, never
> >>>> changes.
> >>>> > >>> >
> >>>> > >>> > Anyone has any idea, what im doing wrong??
> >>>> > >>> >
> >>>> > >>>
> >>>> > >>>
> >>>> > >>>
> >>>> > >>> --
> >>>> > >>> *Rick Curtis*
> >>>> > >>>
> >>>> > >>
> >>>> > >>
> >>>> > >>
> >>>> > >> --
> >>>> > >>
> -------------------------------------------------------------------
> >>>> > >> *SCJA. José Luis Cetina*
> >>>> > >>
> -------------------------------------------------------------------
> >>>> > >>
> >>>> > >
> >>>> > >
> >>>> > >
> >>>> > > --
> >>>> > >
> -------------------------------------------------------------------
> >>>> > > *SCJA. José Luis Cetina*
> >>>> > >
> -------------------------------------------------------------------
> >>>> > >
> >>>> >
> >>>> >
> >>>> >
> >>>> > --
> >>>> > -------------------------------------------------------------------
> >>>> > *SCJA. José Luis Cetina*
> >>>> > -------------------------------------------------------------------
> >>>> >
> >>>>
> >>>>
> >>>>
> >>>> --
> >>>> *Rick Curtis*
> >>>>
> >>>
> >>>
> >>>
> >>> --
> >>> -------------------------------------------------------------------
> >>> *SCJA. José Luis Cetina*
> >>> -------------------------------------------------------------------
> >>>
> >>
> >>
> >>
> >> --
> >> -------------------------------------------------------------------
> >> *SCJA. José Luis Cetina*
> >> -------------------------------------------------------------------
> >>
> >
> >
> >
> > --
> > -------------------------------------------------------------------
> > *SCJA. José Luis Cetina*
> > -------------------------------------------------------------------
> >
>
>
>
> --
> -------------------------------------------------------------------
> *SCJA. José Luis Cetina*
> -------------------------------------------------------------------
>

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