Affichage des articles dont le libellé est JPA. Afficher tous les articles
Affichage des articles dont le libellé est JPA. Afficher tous les articles

vendredi 16 octobre 2015

How to disable the shared cache?

EclipseLink/FAQ/How to disable the shared cache?

By default EclipseLink enables a shared object cache to cache objects read from the database to avoid repeated database access. If the database is changed directly through JDBC, or by another application or server, the objects in the shared cache will be stale.
EclipseLink offers several mechanism to deal with stale data including:
  • Refreshing
  • Invalidation
  • Optimistic locking
  • Cache coordination
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>NONE</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 { ...
}Do not disable the cache by setting the CacheType to None, this can cause object identity issues.
See also, Caching Example and the Caching section of the EclipseLink JPA User Guide for more information on caching.

mardi 16 juin 2015

NoSQL NoJPA just jaxb, xpath, xslt

In some cases the usage of a Data base is over the needs. Sometimes a persitence on disk as (key, value)  concept is suffisant. The key is the path on disk and the value is the file result of marshaling the object.

Let take a simple CRUD example and show how to make the job done.