[odb-users] Object not persistent

Andreas Gerasch gerasch at informatik.uni-tuebingen.de
Tue Jul 5 10:59:37 EDT 2011


Hi Boris,

thanks for your fast reply.

We now figured out, that links (we use raw pointers) between our objects 
are not correct in the database, they just point to random numbers.

So, something went wrong during the persist process. Is there something 
special when using raw pointers?

Thanks a lot,

Andreas


On 07/05/2011 03:26 PM, Boris Kolpackov wrote:
> Hi Andreas,
>
> Andreas Gerasch<gerasch at informatik.uni-tuebingen.de>  writes:
>
>> Persist is already working, but we have trouble while loading the
>> objects. We always get a odb::object_not_persistent error with most of
>> our objects, only very simple objects can be loaded.
>>
>> How can we find out what is going wrong?
>
> I assume you are using the load() function to load an object given
> its id. There are two things that determine what will be loaded
> (and whether it will be found) when using this function:
>
> 1. Object type. This is what you specify in<>  brackets after
>     load, as in "load<person>  (1);". The type determines the
>     table in which ODB will look for the object.
>
> 2. Object id. This is the argument you pass to the load() function.
>
> Both of these parameters have to be correct. If you think that the
> object is in the database but load() still fails, then I suggest
> that you connect to the database using the mysql client and see
> if the object is indeed there. For example, you could run a
> query like this:
>
> select * from person where id = 1;
>
> Here 'person' is the name of the table where the person objects
> are stored (normally just the class name) and 'id' is the name
> of the column that is the primary key (normally the name of the
> data member designated as object id).
>
> If this still does not help (i.e., you see the object in the
> database but load() still fails), then I would need a small test
> case that reproduces this problem.
>
> Boris

-- 
Dipl.-inform. Andreas Gerasch

Arbeitsbereich Algorithmik
Prof. Michael Kaufmann

Mathematisch-Naturwissenschaftliche Fakultät
Fachbereich Informatik (Wilhelm-Schickard-Institut)
Universität Tübingen

Sand 13, Raum B113
72076 Tübingen

+49 7071 29 70484
+49 173 979 2247 (mobil)



More information about the odb-users mailing list