Ekin, A testcase would be much appreciated since neither Fay nor I have had much luck reproducing the problem.
Your post about QuerySQLCache=false fixing an ordering problem is also concerning. The two operations are considerably unrelated (unless the delete is failing as a side effect to incorrect data being returned by the cached query). You may also want to try tagging your entities with @ForeignKey as appropriate or adding the property openjpa.jdbc.SchemaFactory=native(ForeignKeys=true) to instruct OpenJPA to read FK information as it does schema validation. That will help the provider determine correct statement execution order. If this does not correct the problem and you can provide a test, that would be a significant help. -Jeremy
