[odb-users] Object not persistent

Andreas Gerasch gerasch at informatik.uni-tuebingen.de
Wed Jul 6 04:26:14 EDT 2011


Hi Boris,

> The order of the persist () calls becomes important if you are using
> automatically-assigned object ids (in the above example we used manually-
> assigned ids). In this case, because the id is assigned by the database
> during the persist() call, we must serialize the objects in the correct
> order, which is pointed-to object (employer) first and pointing object
> (employee) second. For example:

okay, this the problem. We thought, ids are automatically assigned to 
referenced objects, if not already existing.

Would it be possible to introduce this feature in future?

Is it possible to have bi-directional dependencies and auto ids working 
together?

Thanks a lot,

Andreas



>
> #pragma db object
> class employer
> {
>    #pragma db id auto
>    unsigned int id;
> };
>
> #pragma db object
> class employee
> {
>    #pragma db id auto
>    unsigned int id;
>
>    employer* er;
> };
>
> employer er;
> employee ee;
> ee.er =&er;
>
> db->persist (er); // Assigns er.id
> db->persist (ee); // Uses ee.er->id
>
> 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