openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r835563 - in /openjpa/branches/1.3.x: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkJPQLAndDataCache.java
Date Thu, 12 Nov 2009 21:31:31 GMT
Author: faywang
Date: Thu Nov 12 21:31:31 2009
New Revision: 835563

URL: http://svn.apache.org/viewvc?rev=835563&view=rev
Log:
OPENJPA-1380: query cache is not evicted invalid object when a   cross-join jpql is involved.

Modified:
    openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
    openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkJPQLAndDataCache.java

Modified: openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=835563&r1=835562&r2=835563&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
(original)
+++ openjpa/branches/1.3.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
Thu Nov 12 21:31:31 2009
@@ -669,7 +669,8 @@
         // which is the desired candidate
         if (ctx().schemaAlias == null)
             setCandidate(cmd, alias);
-
+        else
+            addAccessPath(cmd);
         return exp;
     }
 

Modified: openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkJPQLAndDataCache.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkJPQLAndDataCache.java?rev=835563&r1=835562&r2=835563&view=diff
==============================================================================
--- openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkJPQLAndDataCache.java
(original)
+++ openjpa/branches/1.3.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/datacache/TestBulkJPQLAndDataCache.java
Thu Nov 12 21:31:31 2009
@@ -35,6 +35,7 @@
     public void setUp() throws Exception {
         setUp("openjpa.DataCache", "true",
             "openjpa.RemoteCommitProvider", "sjvm",
+            CLEAR_TABLES, 
             AllFieldTypes.class, CascadeParent.class, CascadeChild.class);
 
         OpenJPAEntityManager em = emf.createEntityManager();
@@ -123,4 +124,35 @@
             getResultList().size());
         em.close();
     }
+    
+    public void testCrossJoinQueryCache() {
+        EntityManager em = (OpenJPAEntityManager) emf.createEntityManager();
+        // create
+        em.getTransaction().begin();
+        CascadeParent p = new CascadeParent();
+        p.setName("p1");
+        CascadeChild c = new CascadeChild();
+        c.setName("p1");
+        p.setChild(c);
+        em.persist(p);
+        em.getTransaction().commit();
+
+        // query
+        String jpql = "select p.name, c.name from CascadeParent p, CascadeChild c where p.name
= c.name "
+                + "and p.name = 'p1'";
+        javax.persistence.Query query = em.createQuery(jpql);
+        List result1 = query.getResultList();
+        assertEquals(1, result1.size());
+
+        // update
+        em.getTransaction().begin();
+        c.setName("c1");
+        em.getTransaction().commit();
+
+        // query again
+        List result2 = query.getResultList();
+        assertEquals(0, result2.size());
+        em.close();
+    }
+    
 }



Mime
View raw message