The ObjectCache stores all Objects loaded by the
org.apache.ojb.broker.PersistenceBroker from a DB.
When the PersistenceBroker tries to get an Object by its Primary key values
it first lookups the cache if the object has been already loaded and cached.
Using an ObjectCache has several advantages:
- it increases performance as it reduces DB lookups.
- it allows to perform circular lookups (as by crossreferenced objects)
that would result in non-terminating loops without such a cache. This will be internally handled by OJB, no
need to take care of this.
- it maintains the uniqueness of objects as any Db row will be mapped to
exactly one object.
This interface allows to have userdefined Cache implementations.
The ObjectCacheFactory is responsible for generating cache instances.
by default it uses the OJB
ObjectCacheDefaultImpl .
Used to cache objects by it's
org.apache.ojb.broker.Identity .
Parameters: oid - Identity of the object to cache. Parameters: obj - The object to cache.
Lookup object with Identity 'oid' in cache.
Parameters: oid - Identity of the object to search for. The cached object or null if no matching object forspecified org.apache.ojb.broker.Identity is found.