Thank you so much. This seems to do the trick. I had generated my classes using NetBeans and it seems to have used the the foreign keys in the database to generate the relationship. So I was expecting OpenJPA to figure out foreign keys from the generated class hierarchy, relationships and cascade attributes.
It seems it takes native(ForeignKeys=true) for OpenJPA to read and understand the foreign keys. Its extremely valuable so much so that I would think this should be default behavior. thanks again, -Sanjay techhusky wrote: > > Sanjay, > > If you have foreign keys that are not known to OpenJPA (which is more > likely when you are mapping to a schema that was not created by the > mapping tool), statements may not get ordered correctly. If this is > the case, adding this property to your persistence.xml may correct the > problem: > > <property name="openjpa.jdbc.SchemaFactory" > value="native(ForeignKeys=true)"/> > > This will result in object mapping validation against the database > schema, picking up additional foreign key constraints. > > -Jeremy > > -- View this message in context: http://www.nabble.com/Foreign-key-violation-while-persisting---statement-order-issue.-tp18062156p18104004.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
