[odb-users] Persisting objects after ID change

Erez Pics picserez at gmail.com
Tue Dec 23 08:22:25 EST 2014


 Hi Boris,

Following what I wrote before regarding temp identifiers, ODB works
GREAT with negative value IDs, however it fails updating the new ID.

I am testing that the new identifier is changed properly on the main
object and on it's child records. I have defined ON UPDATE CASCADE on
the FK in the schema on the child records and created an inverse
relationship between my ODB object and it's child records.

The flow: I have an ODB object that has been persisted before with a
temp identifier, I set a new value to it's identity field and call
data_base->update(object), the result "object not persistent"
exception, ODB refuses to update an existing object to use the new
identifier.

If I call data_base->persist(object) it succeeds however a NEW record
is created, the child records are updated properly when saved and
point to the new record but I am left with the old object in the DB so
other FK records still point to the old object.

 Can you please advice how to resolve this problem ?

Thank you very very much for you help,
Erez.



More information about the odb-users mailing list