openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Weiss <>
Subject Own UpdateManager - but issue with "isPersistent" and "isFlushed" for new JPA entities
Date Thu, 31 Jul 2014 19:13:21 GMT
Dear Community, 

For our project we added an own UpdateManager for OpenJPA.  We use the 
UpdateManager to do "explicit updates" for our JPA entities. 
This means that we use the UpdateManager to filter the set of JPA objects 
and to pass forward only  those JPA entities that we want be explicitly 
insert or update in the database. 

The UpdateManager is defined in the persistence.xml and working fine: 

 <property name="openjpa.jdbc.UpdateManager" value="OurOwnUpdateManager" 

However we have an issue with new JPA entities we create within our use 
case / transaction.
The issue:  The new entities are created at the beginning and known to the 
EntityManager when we create them. 
They are in the initial newState with isFlush=false and isPersist = false. 
So far so good. 

However when we run a "flush() operation" - e.g. to update the another 
objects. The new objects change the state to isPersist and isFlushed. 
However no update is happening on the database. 
Even if they are not passed from our UpdateManager to the 

At the end when we pass the objects (e.g. in the third flush operation) 
the EntityManager thinks that the objects are already existing and does an 
update on the tables instead of the an insert. 
And so our application fails. 

Is there are chance to prevent OpenJPA to set new created objects to 
isPersist and isFlushed? 
Is it the expected behavior of OpenJPA (meaning that the EntityManager 
might change the state of objects during the flush operations that are not 
passed to the  BatchingConstraintUpdateManager.udpate... ). 
Is there a way to reset the state of the objects to tell OpenJPA in one of 
the following flushs to do the insert instead of an update? 

Looking forward to any helpful hints, tips and explanations! Thanks in 
advance ; ) 


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