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)

Hi,
 
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(AdvancedQueryTestSuite.java:775)
at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:457)
0.015
 
Seems that the very feature I was investigating just stopped working in the very same moment …
 
-Adrian
 
 
_____________________________________________
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)
 
 
Hi,
 
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) })
@Cacheable(true)
@Entity
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 {
        init();
        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 {
            closeEntityManager(em);
        }
    }
 
 
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
 
Adrian Görler
SAP AG

Pflichtangaben/Mandatory Disclosure Statements: http://www.sap.com/company/legal/impressum.epx
 
 
 

Back to the top