You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by patrice <pa...@t2b.ch> on 2015/07/01 10:05:59 UTC

Flush throws EntityExistsException

Hello,

Flush is throwing the following exception:

.<openjpa-2.3.0-r422266:1540826 fatal store error>
org.apache.openjpa.persistence.EntityExistsException: The transaction has
been rolled back.  See the nested exceptions for details on the errors that
occurred.
FailedObject: com.xxx.d2p106.jpa.entities.V06Studies@2dfec3a1
                at
org.apache.openjpa.kernel.BrokerImpl.newFlushException(BrokerImpl.java:2370)
                at
org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java)
                at
org.apache.openjpa.kernel.BrokerImpl.flushSafe(BrokerImpl.java:2105)
                at
org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1876)
                at
org.apache.openjpa.kernel.DelegatingBroker.flush(DelegatingBroker.java:1045)
                at
org.apache.openjpa.persistence.EntityManagerImpl.flush(EntityManagerImpl.java:663)
                at
com.xxx.d2p106.DatastoreUpserter.processSequence(DatastoreUpserter.java:443)


The code essentially looks like this:


                    dbTransaction = em.getTransaction();
		    dbTransaction.begin();
                    
		    Query query = em.createNamedQuery("V06Studies.findByStudyCodeNcc");
                    query.setParameter("studyCodeNcc",
xmlStudy.getStudyCodeNcc());
                    dbStudy = (V06Studies) query.getSingleResult();
                    

                    dbStudy.setAgeMaximum(xmlStudy.getAgeMaximum());
                    dbStudy.setAgeMinimum(xmlStudy.getAgeMinimum());
 		     ... other sets
                                
             
                    em.flush();


I tried setting this property but to no avail:
puProps.put("openjpa.Compatibility","CheckDatabaseForCascadePersistToDetachedEntity=true");


Any thoughts will be greatly appreciated.

Thank you in advance,
Patrice






--
View this message in context: http://openjpa.208410.n2.nabble.com/Flush-throws-EntityExistsException-tp7588356.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.