|Oracle® Fusion Middleware Integration Guide for Oracle TopLink with Coherence Gird
11g Release 1 (11.1.1)
Part Number E16596-01
This section includes information on the following:
To get an entity from the Coherence cache with a specific ID (key), use:
em.find(Employee.class, 8) will get the entity with key 8, from the Coherence Employee cache.
If the entity is not found in the Coherence cache, TopLink executes a
SELECT statement against the database. If a result is found, then the entity is constructed and placed into Coherence.
To get an entity that matches a specific selection criteria, use:
em.createQuery("..."). For example,
em.createQuery("select e from Employee e where e.name='John'") will execute a SELECT statement against the database to find employees with the name of John.
The query's specific behavior will depend on you Coherence cache configuration.
Grid Cache – The query will always check the database.
You can use query hints to direct the query to the database instead of the Coherence cache.
CacheStore/CacheLoader – Non-primary key queries will check the database. Primary key queries are performed against the Coherence cache first.
You should be aware of the following limitations when querying Coherence:
JPQL Bulk Updates and Deletes – This release of TopLink Grid does not provide support for JPQL bulk updates and deletes.
Joins – Because the Coherence Filter framework is limited to a single cache, JPQL join queries cannot be translated to Filters – all join queries will execute on the database.
Coherence will continue to be used to avoid object constructions costs for the query results.
Projection queries – This release of TopLink Grid does not provide support for projection queries (reports).