[odb-users] Sqlite and foreign key exception

Boris Kolpackov boris at codesynthesis.com
Fri Nov 8 02:22:06 EST 2013


Hi Philipp,

Philipp Maluta <ensoreus at mail.ru> writes:

> I added a lines you provided and:
> ./rpersistant --create --database notes.db
> forein key ...
> schema created
> foreign keys enabled
> 19: foreign key constraint failed

Which confirms my suspicion: the exception is thrown by some other
code in your application.

Try to find out which transaction causes it (the exception will be
thrown from commit()). Then make sure all the objects that you
point to are actually made persistent. The common cause of the
foreign key exception is forgetting to call persist() for the
other end of the relationship (or calling it in incorrect order
if you use auto ids).

Boris



More information about the odb-users mailing list