Just to add to Pinaki's reply. OpenJPA can order the SQL updates appropriately, but only if the openjpa.jdbc.UpdateManager is set to one of the constraint update managers (constraint or batching-constraint). See this section<http://openjpa.apache.org/builds/apache-openjpa-1.2.3-SNAPSHOT/docs/manual/manual.html#openjpa.jdbc.UpdateManager>of the manual for a little more information.
Note that using OpenJPA in RAD may have a different default value of this configuration option. It might be best to explicitly set it to constraint to ensure you're getting the expected value. If you're sure you're using the constraint update manager, then you can tell OpenJPA to read the database schema with the openjpa.SchemaFactory property. Set it to 'native' in your persistence.xml file like this : <property name="openjpa.jdbc.SchemaFactory" value="native"/>. The SchemaFactory property controls how OpenJPA reads schema information. The SynchronizeMappings property from Pinaki's email tells OpenJPA to build the database objects based on your entities. They're related, but slightly different. Hope this helps -mike On Thu, Oct 13, 2011 at 8:16 AM, Pinaki Poddar <ppod...@apache.org> wrote: > Hi, > > I'm not at liberty to change this structure or the RI. > did you tell OpenJPA to read the database foreign key constraints? > OpenJPA > update can topologically sort a to-be-committed graph of objects to honor > database constraints -- but the quality of sort depends on supplied > information. > If you have not, please see openjpa.jdbc.SynchronizeMappings property. > > ----- > Pinaki Poddar > Chair, Apache OpenJPA Project > -- > View this message in context: > http://openjpa.208410.n2.nabble.com/Delete-OptimisticLock-exception-when-entity-appears-2x-in-cascade-graph-tp6882907p6888860.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >