[odb-users] Problem with updating a transient object when adding a ptr in a to-many relationship

Chris Visser chris at cwmmarketing.co.za
Thu Feb 25 05:53:37 EST 2016


Hi Boris

I found the problem while writing a test case for you.

My database was set up with the intermediary table having  IDENTITY on the
index column.

Object_id INT
Index INT IDENTITY
Value varchar(255);

It was stipulated as such in the #pragma for the fields to accommodate for
the database attributes. But it caused the "object_already_persisted"
exception. When I removed the IDENTITY setting on the Index column,
everything worked fine. I also see that ODB handles the INDEX column the
same as an IDENTITY column, and it is not needed to have it on the table.

Regards


Chris


-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: 23 February 2016 16:22
To: Chris Visser
Cc: odb-users at codesynthesis.com
Subject: Re: [odb-users] Problem with updating a transient object when
adding a ptr in a to-many relationship

Hi Chris,

Chris Visser <chris at cwmmarketing.co.za> writes:

> I am using SQL Server, and the line giving the problem is 
> db->update(John);

That would mean the object that 'John' points to is not persistent, for some
reason. Try to print the object id of object(s) that are in John's vector
and see if they are actually in the database.

If that doesn't shed any light, then I will need a small but complete test
case that I can use to reproduce the problem.

Boris



-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7442 / Virus Database: 4537/11684 - Release Date: 02/23/16




More information about the odb-users mailing list