Bug 366006 - Query cache does not work with <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>
Summary: Query cache does not work with <shared-cache-mode>ENABLE_SELECTIVE</shared-ca...
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-08 05:59 EST by Frederick CLA
Modified: 2022-06-09 10:05 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Frederick CLA 2011-12-08 05:59:58 EST
I am trying to get the eclipse link query result cache to work with <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> setting in persistence.xml, so far without success. It works fine with DISABLE_SELECTIVE and ALL.

Here's a NamedQuery example:

@NamedQuery(name = "MyEntity.findAll", query = "select m from MyEntity m where m.active=true order by m.id",
    hints = {
        @QueryHint(name = QueryHints.CACHE_USAGE, value = CacheUsage.CheckCacheThenDatabase),
        @QueryHint(name = QueryHints.QUERY_TYPE, value = QueryType.ReadAll),
        @QueryHint(name = QueryHints.QUERY_RESULTS_CACHE, value = HintValues.TRUE)
    })}

Even though the QUERY_RESULTS_CACHE is enabled, every execution of the named query hits the database. If it matters MyEntity has both a @Cacheable and a  annotation and org.eclipse.persistence.annotations.Cache.

I also tried using the JPA2 properties:
@QueryHint(name = QueryHints.CACHE_STORE_MODE, value="USE"),
@QueryHint(name = QueryHints.CACHE_RETRIEVE_MODE, value="USE")
Comment 1 Tom Ware CLA 2011-12-22 10:37:17 EST
Setting target and priority.  See the following page for the meanings of these fields:

http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines

Community: Please vote for this bug if it is important to you.  Votes are one of the main criteria we use to determine which bugs to fix next.
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:05:43 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink