The protected cache option allows for shared objects to reference isolated objects. Setting the cache isolation to PROTECTED for an entity enables its shared cache. The protected option is mostly the same as the shared option, except that protected entities can have relationships to isolated entities, where as shared can not.
what is the meaning of this exception. does this make the isolated entity shared if they have relationship with protected entity
public enum SharedCacheMode extends Enum<SharedCacheMode> Specifies how the provider must use a second-level cache for the persistence unit. Corresponds to the value of the persistence. xml shared-cache-mode element, and returned as the result of PersistenceUnitInfo. getSharedCacheMode() .
The cache isolation level defines how caching for an entity is performed by the persistence unit and the persistence context.
An isolated entity is isolated, so it can never be in the shared cache. Protected vs shared only affect the entity it is applied to, and what references it is allowed to keep. References to isolated entities require special handling (and overhead) so that the isolated entities don't end up in the shared cache, hence shared entities allowing references to isolated entities were given a special designation.
Protected option can be used to ensure read-only entities and queries always copy the cached objects. So you can simulate a data cache with EclipseLink. while shared ready-only will not be copied.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With