liefke / org.fastnate

The Offline SQL Generator
Apache License 2.0
16 stars 11 forks source link

Parent child relationship with preassigned ids -> Referential Integrity Error #30

Closed OHDMax closed 6 years ago

OHDMax commented 6 years ago

When a parent in a parent-child relationship has assigned a manual ID (the ID is not generated) and a child references such a parent, the generated SQL may result in a "Referential Integrity Error". This is because the SQL insert statement of the child references the parent before the insert statement for the parent is written.

Version: 1.4.0-SNAPSHOT (the buildNumber is 6)

liefke commented 6 years ago

Thank you for reporting this.

It is fixed now: The insert statement of the child is written without the parent id, which is updated with the help of an extra statement as soon as the insert of the parent is written.

OHDMax commented 6 years ago

I can confirm, this fixed my issue. Thanks for your fast bugfix!