Incorrect statement order on flush with foreign keys ---------------------------------------------------- Key: OPENJPA-2103 URL: https://issues.apache.org/jira/browse/OPENJPA-2103 Project: OpenJPA Issue Type: Bug Components: jpa Affects Versions: 2.1.1 Reporter: Harald Wellmann Attachments: openjpa-foreign-key.zip In a schema with a cascading association with a foreign key, I'm having strange effects where the SQL statements generated on em.flush() somtimes appear in the wrong order. I've reduced this to a funny case where a passing test starts failing, as soon as it is preceded by em.flush(): @Test public void testFlushFailure() { em.flush(); testFlushOk(); } The same tests both pass on Hibernate. I'm attaching a self-contained Maven Project to demonstrate the issue. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira