Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-dev] WG: @QueryHint(name = QueryHints.QUERY_RESULTS_CACHE, value = HintValues.TRUE)

I synched and ran the JPA tests and the test
org.eclipse.persistence.testing.tests.jpa.jpql. AdvancedQueryTestSuite .testQueryCache fails:
testQueryCacheFailureList result size is not correct.

junit.framework.AssertionFailedError: List result size is not correct.
at org.eclipse.persistence.testing.tests.jpa.jpql.AdvancedQueryTestSuite.testQueryCache(
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(
Seems that the very feature I was investigating just stopped working in the very same moment …
Von: Goerler, Adrian
Gesendet: Montag, 25. Januar 2010 18:27
An: Dev mailing list for Eclipse Persistence Services
Betreff: @QueryHint(name = QueryHints.QUERY_RESULTS_CACHE, value = HintValues.TRUE)
I am experiencing trouble with this query hint
@NamedQuery(name = "getAllDepartmentsCached", query = "select d from Department d", hints = { @QueryHint(name = QueryHints.QUERY_RESULTS_CACHE, value = HintValues.TRUE) })
public class Entity Department {
The first time, I am executing the named query, I get the expected result. But if I execute it again, the result is empty:
   public void testCachedQueryWithoutParameters() throws SQLException {
        EntityManager em = getEnvironment().getEntityManager();
        try {
            Query query = em.createNamedQuery("getAllDepartmentsCached");
            List<Department> result = query.getResultList();
            assertEquals(result.size(), 2);
            result = query.getResultList();
            assertEquals(result.size(), 2); <<<<< size is 0 now!
        } finally {
Are there any preconditions I’d have to fulfill in order to uses the QUERY_RESULTS_CACHE hint?
I have switched the default caching off:
<property name="eclipselink.cache.shared.default" value="false"/>
Any ideas?
Adrian Görler

Pflichtangaben/Mandatory Disclosure Statements:

Back to the top