EclipseLink/UserGuide/JPA/Basic JPA Development/Caching/Indexes

From Eclipsepedia

< EclipseLink‎ | UserGuide‎ | JPA‎ | Basic JPA Development‎ | Caching
Revision as of 10:09, 24 May 2012 by James.sutherland.oracle.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

EclipseLink JPA

link="http://wiki.eclipse.org/EclipseLink"
EclipseLink
Website
Download
Community
Mailing ListForumsIRC
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse Source

Elug api package icon.png Native API

Cache Indexes

Expiry can also be used in the query results cache (see Query Results Cache).

Cache index annotation example
...
@Entity
@Cache(
  expiry=600000 // 10 minutes
)
public class Employee {
  ...
}
...
@Entity
@Cache(
  expiryTimeOfDay=@TimeOfDay(hour=3) // 3:00 AM
)
public class Project {
  ...
}
Cache index XML example
<?xml version="1.0"?>
<entity-mappings
	xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/orm"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.eclipse.org/eclipselink/xsds/persistence/orm http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_2_4.xsd"
	version="2.4">
    <entity name="Employee" class="org.acme.Employee" access="FIELD">
        <cache>
            <expiry>600000</expiry>
        </cache>
    </entity>
    <entity name="Project" class="org.acme.Project" access="FIELD">
        <cache>
            <expiry-time-of-day hour="3"/>
        </cache>
    </entity>
</entity-mappings>

Eclipselink-logo.gif
Version: 2.4 DRAFT
Other versions...