[odb-users] Object not persistent
Andreas Gerasch
gerasch at informatik.uni-tuebingen.de
Wed Jul 6 05:13:45 EDT 2011
Hi Boris,
> I am not sure it is possible to implement something like this. An id
> is assigned (by the database) when the object is persisted (a row is
> inserted into the database). So persisting of an object and assigning
> of an id always go together. Some databases have a concept of sequences
> in which case it is theoretically possible to first ask for an id and
> then serialize the object. But that would make it less efficient since
> we will need to perform a SELECT and an INSERT instead of just the INSERT.
I think, it would be possible, if you do this in the commit method. So
the persist(..) function creates the database row and assigns the auto
id to the object. You collect all objects which have been persisted in
this transaction and "persist" them a second time, where you update all
references.
Andreas
More information about the odb-users
mailing list