[odb-users] Problem with session cache and weak_ptr

Boris Kolpackov boris at codesynthesis.com
Wed May 25 19:54:45 EDT 2016


Hi Marcel,

Marcel Nehring <mne at qosmotec.com> writes:

> so a lazy pointer is meant to store a transient object (if no database
> object was provided) and a persistent object (if a database object was
> provided) and handle the differentiation internally?

I am not sure what you mean by "handle the differentiation". A lazy
pointer is essentially an eager pointer plus the {id,db} pair which
can be NULL. If the pair is NULL, then the pointer is transient.


> So if persisting the object before assigning it (as you suggested)
> is not a option, one could later reset it or update the ID? Is this
> the expected usage?

I don't think you can update the ID directly. But resetting it, yes,
that would force the ID re-query.

Boris



More information about the odb-users mailing list