4.11. SQL Statement Ordering & Foreign Keys

Kodo JDO can be configured to order SQL updates to meet foreign key constraints through the boolean kodo.jdbc.ForeignKeyConstraints configuration property.

SQL statement ordering to match foreign key constraints is disabled by default. If you use foreign keys in your schema, we recommend configuring your database to use deferred foreign keys whenever possible. Deferred constraints are not evaluated until the end of the transaction, giving you greater freedom in how you design your constraints and better performance than Kodo JDO's in-memory statement ordering. If your database does not support deferred constraints, however, Kodo JDO's automatic statement ordering will make sure all dependencies are met, including circular dependencies. The example below shows how to enable statement ordering in your configuration properties file.

Example 4.14. Enabling SQL Statement Ordering

kodo.jdbc.ForeignKeyConstraints: true