If the shared-cache-mode element of persistence.xml is set to ENABLE _SERVICE, which entities are cached when using a persistence provider that supports caching?

Given the following entity classes:

@Entity
@cacheable (true)
Public class A { . . . }
—-@Entity
@cacheable (false)
Public class B { . . .}
@Entity
Public class C { . . . }

If the shared-cache-mode element of persistence.xml is set to ENABLE _SERVICE, which entities are cached when using a persistence provider that supports caching?

Given the following entity classes:

@Entity
@cacheable (true)
Public class A { . . . }
—-@Entity
@cacheable (false)
Public class B { . . .}
@Entity
Public class C { . . . }

If the shared-cache-mode element of persistence.xml is set to ENABLE _SERVICE, which entities are cached when using a persistence provider that supports caching?

A.
A only

B.
A and B

C.
A and C

D.
A, B, and C



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Mohamed Fayek

Mohamed Fayek

ANSWER : A

1.shared-cache-mode=ENABLE_SELECTIVE mean, only those entities for which @Cacheable(true) is specified are cached.

2.DISABLE_SELECTIVE is the exact opposite. All entities are cached except the ones for which @Cacheable(false) is specified.

3.NONE means, none of the entities will be cached irrespective of the @Cacheable value and ALL means all the entities will be cached

4.If shared-cache-mode is not specified or if it is set to UNSPECIFIED, then the behavior is undefined.