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>

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 {
  ...
}
posted @ 2013-06-05 11:13  sofia  阅读(694)  评论(0编辑  收藏  举报