Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents


Use @Noncacheable to configure caching behavior for relationships. If used on a relationship, that relationship will not be cached, even though the parent Entity may be cached.

Annotation Elements

There are no elements for this annotation.


Each time EclipseLink retrieves the Entity, the relationship will be reloaded from the datasource. This may be useful for situations where caching of relationships is not desired or when using different EclipseLink cache types and having cached references extends the cache lifetime of related Entities using a different caching scheme. For instance Entity A references Entity B, Entity A is Full and Entity B is Weak. Without removing the caching of the relationsip the Entity B's cache effectively become Full.


Example 2-76 shows how to use @Noncacheable to create a protected cache.

Example 2-76 Using @Noncacheable Annotation

public class Employee {
  private long id;
  private List<Employee> managedEmployees;

Example 2-77 shows using the <noncacheable> XML element in the eclipselink-orm.xml file.

Example 2-77 Using <noncacheable> XML

<?xml version="1.0"?>
    <entity name="Employee" class="org.acme.Employee" access="FIELD">
        <cache isolation="PROTECTED"/>
            <id name= "id"/>
            <one-to-many name="managedEmployees" mapped-by="manager">

See Also

For more information, see: