This section includes information on the following:

Wrapping and Unwrapping

When storing Entities with relationships in the Coherence cache, TopLink Grid generates a wrapper class that maintains the relationship information. In this way, when the object is read from the Coherence cache (eager or lazy), the relationship can be resolved.

If you read Entities directly from the Coherence cache using the Coherence API, the wrappers are not automatically removed. You must configure automatic unwrapping on a get in your code or by setting the property on the serializer, as shown in Example 16. You can also set the system property as eclipselink.coherence.not-eclipselink to automatically unwrap an entity.

When configured properly, the read will return the wrapped Entity.

Example 16 Unwrapping an Entity

WrapperSerializer wrapperSerializer = (WrapperSerializer)myCache.getCacheService().getSerializer();
wrapperSerializer.setNotEclipseLink(true); // to let the Serializer know it needs to unwrap when clients get() from the cache