Table of Contents
As mentioned before, this mechanism is used in the method createExisting with one of the parameter combinations:
createExisting(ObjectId id)
or
createExisting( String dbName, ObjectId id, [HashMap refs])
or
createExisting( ObjectId id, [HashMap refs], [DBTransaction dbTrans]).
for retrieving DO with specified oid from the database.
When caching is used, the only difference is that this method first checks whether there is DataStruct object with the specified oid in the DataStruct cache. If yes, this DataStruct object is used for creating DO, and this DO is returned.
If the specified oid doesn't exist in the DataStruct cache, the rest of the method is the same: DO with specified oid (DO without data) is created using constructor, and then, if lazy loading is off, the method
loadData()
is called to load the fields for the DO from the database.
Lazy data objects (whose original data originalData is empty) are not added to the DataStruct cache. After they are loaded (with loadData() method), their original data originalData is added to the DataStruct cache.