jpa disable cache

1.     http://en.wikibooks.org/wiki/Java_Persistence/Caching#Example_JPA_2.0_Cacheable_annotation

Example JPA 2.0 SharedCacheMode XML 

<persistence-unit name="ACME">
  <shared-cache-mode>NONE</shared-cache-mode>
</persistence-unit>
2. http://wiki.eclipse.org/EclipseLink/FAQ/How_to_disable_the_shared_cache%3F

The shared cache can also be disabled. This can be done using the EclipseLink persistence unit property:

<property name="eclipselink.cache.shared.default" value="false"/>

Or the JPA 2.0 persistence unit element:

<shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>

Or can be selectively enabled/disabled using the @Cache annotation:

@Entity
@Cache(isolation=ISOLATED)
public class Employee {
  ...
}

Or the JPA 2.0 @Cacheable annotation:

@Entity
@Cacheable(false)
public class Employee {
  ...
}

你可能感兴趣的:(jpa disable cache)