The same result. The problem still. What else can i do?
2013/3/12 Rick Curtis <curti...@gmail.com> > Iteresting.... what happens if you find the object via JPQL vs criteria > query? > > > On Tue, Mar 12, 2013 at 2:27 PM, José Luis Cetina <maxtorz...@gmail.com > >wrote: > > > Something estrange is happen here. Maybe could be a bug. > > > > Look this. > > In ejb module the way that actually i retrieve my entities. > > 1. > > public List<MyObject> getObjects(){ > > CriteriaBuilder cb = em.getCriteriaBuilder(); > > CriteriaQuery<MyObject> cq = cb.createQuery(MyObject.class); > > Root<MyObject> root = cq.from(MyObject.class); > > cq.select(root); > > return em.createQuery(cq).getResultList(); > > } > > > > Then for test i decided to only retrieve 1 entity and not all of them, > then > > > > Option 1. The problem still. > > > > public MyObject getObject(){ > > CriteriaBuilder cb = em.getCriteriaBuilder(); > > CriteriaQuery<MyObject> cq = cb.createQuery(MyObject.class); > > Root<MyObject> root = cq.from(MyObject.class); > > cq.select(root); > > cq.where(cb.equal(root.get(MyObject.id), 1)); > > return em.createQuery(cq).getSingleResult(); > > } > > > > > > Option 2. The problem disappear > > public MyObject getObject(){ > > return em.find(MyObject.class, 1); > > } > > > > Why????? > > > > What happen when i use the criterias why this works if i use em.find??? > > > > > > 2013/3/12 José Luis Cetina <maxtorz...@gmail.com> > > > > > Here it is, with this example i use kx_examenes_diagnostico persistence > > > unit > > > > > > > > > <?xml version="1.0" encoding="UTF-8"?> > > > <persistence version="2.0" xmlns=" > http://java.sun.com/xml/ns/persistence > > " > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > > xsi:schemaLocation=" > > > http://java.sun.com/xml/ns/persistence > > > http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> > > > <persistence-unit name="kx_core" transaction-type="JTA"> > > > > > > > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > > <jta-data-source>KXCoreDataSource</jta-data-source> > > > <jar-file>../lib/kx-apps-model-1.0.jar</jar-file> > > > <exclude-unlisted-classes>false</exclude-unlisted-classes> > > > <properties> > > > <property name="openjpa.jdbc.DBDictionary" > > > value="mysql(batchLimit=-1)"/> > > > </properties> > > > </persistence-unit> > > > > > > <persistence-unit name="kx_ispconfig" transaction-type="JTA"> > > > > > > > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > > <jta-data-source>ISPConfigDataSource</jta-data-source> > > > <jar-file>../lib/kx-apps-model-1.0.jar</jar-file> > > > <exclude-unlisted-classes>false</exclude-unlisted-classes> > > > <properties> > > > <property name="openjpa.jdbc.DBDictionary" > > > value="mysql(batchLimit=-1)"/> > > > </properties> > > > </persistence-unit> > > > > > > > > > <persistence-unit name="kx_mailing" transaction-type="JTA"> > > > > > > > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > > <jta-data-source>MailingDataSource</jta-data-source> > > > <jar-file>../lib/kx-apps-model-1.0.jar</jar-file> > > > <exclude-unlisted-classes>false</exclude-unlisted-classes> > > > <properties> > > > <property name="openjpa.jdbc.DBDictionary" > > > value="mysql(batchLimit=-1)"/> > > > </properties> > > > </persistence-unit> > > > > > > <persistence-unit name="kx_facturacion" transaction-type="JTA"> > > > > > > > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > > <jta-data-source>FacturacionDataSource</jta-data-source> > > > <jar-file>../lib/kx-apps-model-1.0.jar</jar-file> > > > <exclude-unlisted-classes>false</exclude-unlisted-classes> > > > <properties> > > > <property name="openjpa.jdbc.DBDictionary" > > > value="mysql(batchLimit=-1)"/> > > > </properties> > > > </persistence-unit> > > > > > > > > > <persistence-unit name="kx_examenes_diagnostico" > > > transaction-type="JTA"> > > > > > > > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > > > <jta-data-source>ExamenesDiagnosticoDataSource</jta-data-source> > > > <jar-file>../lib/kx-apps-model-1.0.jar</jar-file> > > > <exclude-unlisted-classes>false</exclude-unlisted-classes> > > > <properties> > > > <property name="openjpa.jdbc.DBDictionary" > > > value="batchLimit=15, JoinSyntax=traditional"/> > > > <property name="openjpa.Log" value="SQL=TRACE, > Query=INFO"/> > > > <property name="openjpa.ConnectionFactoryProperties" > > > value="PrettyPrint=true, PrettyPrintLineLength=80, > > PrintParameters=true"/> > > > </properties> > > > </persistence-unit> > > > > > > <persistence-unit name="kx_rhino" transaction-type="JTA"> > > > > > > > > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > > > <jta-data-source>MyDataSource</jta-data-source> > > > <jar-file>../lib/kx-apps-model-1.0.jar</jar-file> > > > <exclude-unlisted-classes>false</exclude-unlisted-classes> > > > <properties> > > > <property name="openjpa.jdbc.DBDictionary" > > > value="batchLimit=15, JoinSyntax=traditional"/> > > > <property name="openjpa.Log" value="SQL=TRACE, > Query=INFO"/> > > > <property name="openjpa.ConnectionFactoryProperties" > > > value="PrettyPrint=true, PrettyPrintLineLength=80, > > PrintParameters=true"/> > > > </properties> > > > </persistence-unit> > > > > > > </persistence> > > > > > > > > > > > > 2013/3/12 Kevin Sutter <kwsut...@gmail.com> > > > > > >> Hi Jose, > > >> Your scenario looks like the classic use of detached entities and > > merging > > >> them back into a persistence context. This pattern is used over and > > over > > >> again by many customers. Nothing is jumping out at me as to what the > > >> issue > > >> could be. There must be something unique to your scenario or > > environment > > >> that is causing an issue. > > >> > > >> What about your persistence.xml? Can you post that? Any chance you > are > > >> using some openjpa property that might be affecting this processing? > > >> > > >> Kevin > > >> > > >> On Tue, Mar 12, 2013 at 1:28 PM, José Luis Cetina < > maxtorz...@gmail.com > > >> >wrote: > > >> > > >> > This is the scenario: > > >> > > > >> > This is a webapplication, using JSF+EJB > > >> > > > >> > 1. The webpage (jsf) call a method to an EJB, for get a List of > > existent > > >> > entities from database. > > >> > 2. In EJB i get a list (List<MyObject>) of entities let say > > >> > (MyObject.class), i get them using a query. > > >> > 3. The ejb return a list of entities (2 entities for example) of > > course > > >> at > > >> > this point the entities are "sended" by the ejb to the managedbean > > (then > > >> > the entities are out of the persistence context therefore the are > > >> > dettached) > > >> > 4. Then in the managedbean in X method i do the follow: > > >> > - Get 1 of the dettached entities of the list. (MyObject) > > >> > - Change some attribute let say the "DESCRIPTION" attribute > > >> > - The managedbean now CALL and EJB method for do an update of > > this > > >> > entity. > > >> > 5. The EJB method receive 1 MyObject ( public void update(MyObject > > obj) > > >> ) > > >> > 6. Then the EJB method need to call an update because the > > "DESCRIPTION" > > >> > property has changed > > >> > 7. The method is like this: > > >> > > > >> > public void update(MyObject obj){ > > >> > begin transaction... > > >> > em.merge(obj); > > >> > commit transaction... > > >> > } > > >> > > > >> > 8. I get this error: > > >> > <openjpa-2.2.0-r422266:1244990 nonfatal user error> > > org.apache.openjpa. > > >> > persistence.InvalidStateException: Primary key field > > >> com.test.MyObject.idof > > >> > com.test.MyObject@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. > > >> > > > >> > > > >> > > > >> > Notes: > > >> > > > >> > 1. Of course the id of the entity has a value because this was an > > entity > > >> > that the EJB gave me (doing a query to database) and then the only > > >> change > > >> > is the "DESCRIPTION" attribute, that's why i expect merge method to > do > > >> an > > >> > update because the ID HAS THE VALUE RETRIEVED FROM DATABASE. > > >> > > > >> > 2. About i've commented before " > 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.." > > >> > This is a test that i did, i create a new object in my managedbean > > then > > >> > and set the ID to any ID that exists in database then i set a > > >> "description" > > >> > then call ejb and do a merge and this did an update. > > >> > > > >> > Example: > > >> > > > >> > MyMangedBean, > > >> > > > >> > public void someMethod(){ > > >> > MyObject obj = MyObject(); > > >> > obj.setId(1);//this id exist in the database > > >> > obj.setDescription("NEW DESCRIPTION"); > > >> > ejb.update(obj); > > >> > } > > >> > > > >> > 3.The changes in the Object was made in the ManagedBean, thats why > the > > >> > managedbean pass the same object (that it retrieved) but with some > > >> > "attributes changes" (like DESCRIPTION) and the the EJB only need to > > >> merge > > >> > > > >> > > > >> > > > >> > Thanks. > > >> > > > >> > 2013/3/12 Kevin Sutter <kwsut...@gmail.com> > > >> > > > >> > > 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 < > > >> maxtorz...@gmail.com > > >> > > >wrote: > > >> > > > > >> > > > Anyone? > > >> > > > > > >> > > > > > >> > > > 2013/3/11 José Luis Cetina <maxtorz...@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 <maxtorz...@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 <maxtorz...@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 <curti...@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 < > > >> > > > maxtorz...@gmail.com > > >> > > > >>>> >wrote: > > >> > > > >>>> > > >> > > > >>>> > Im using OpenJPA 2.2.0 + enhancement with Apache TomEE > > >> > > > >>>> > > > >> > > > >>>> > > > >> > > > >>>> > 2013/3/11 José Luis Cetina <maxtorz...@gmail.com> > > >> > > > >>>> > > > >> > > > >>>> > > Im using OpenJPA 2.2.0 9 enhancement with Apache TomEE > > >> > > > >>>> > > > > >> > > > >>>> > > > > >> > > > >>>> > > 2013/3/11 José Luis Cetina <maxtorz...@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 <curti...@gmail.com> > > >> > > > >>>> > >> > > >> > > > >>>> > >>> Can you please post the entire stack trace? > > >> > > > >>>> > >>> > > >> > > > >>>> > >>> > > >> > > > >>>> > >>> On Mon, Mar 11, 2013 at 2:23 PM, José Luis Cetina < > > >> > > > >>>> > maxtorz...@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.id652eb3bd > > >> 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* > > >> > > > > > ------------------------------------------------------------------- > > >> > > > > > >> > > > > >> > > > >> > > > >> > > > >> > -- > > >> > ------------------------------------------------------------------- > > >> > *SCJA. José Luis Cetina* > > >> > ------------------------------------------------------------------- > > >> > > > >> > > > > > > > > > > > > -- > > > ------------------------------------------------------------------- > > > *SCJA. José Luis Cetina* > > > ------------------------------------------------------------------- > > > > > > > > > > > -- > > ------------------------------------------------------------------- > > *SCJA. José Luis Cetina* > > ------------------------------------------------------------------- > > > > > > -- > *Rick Curtis* > -- ------------------------------------------------------------------- *SCJA. José Luis Cetina* -------------------------------------------------------------------