[odb-users] Inconsistency in documentation?
mne at qosmotec.com
Thu Feb 18 10:01:25 EST 2016
I think there is an inconsistency in the documentation.
I am using sessions and the optimistic concurrency model. When I now want to discard local changes to persistent objects that I only performed in my local memory (i.e. overwrite my local state with the one from the database) I need to use ODB's database::load function taking a database ID and an object instance. I find it a bit strange that database::reload does not do this, but this is documented, so I guess there is a good reason for it. Anyhow, when using sessions, I thought that database::load always returns the current session's cached version.
In 11.1 "Object Cache" it is stated, that "For as long as the session is in effect, any subsequent calls to load the same object will return the cached instance".
In 3.9 "Loading Persistent Objects", however, it is stated that "In certain situations it may be necessary to reload the state of an object from the database [...] this is easy to achieve using the second load() function". Where "the second load function" is the one taking an ID and an existing instance.
Ok, in 11.1 we speak of the same object being "returned" whereas the database::load() function's return type is void but this might be a bit subtle. At least I misunderstood it up until now.
More information about the odb-users