openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jrba...@apache.org
Subject svn commit: r740314 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java
Date Tue, 03 Feb 2009 14:46:17 GMT
Author: jrbauer
Date: Tue Feb  3 14:46:17 2009
New Revision: 740314

URL: http://svn.apache.org/viewvc?rev=740314&view=rev
Log:
OPENJPA-869 Added query expression to target a specific entity during validation

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java?rev=740314&r1=740313&r2=740314&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/order/TestOrderColumn.java
Tue Feb  3 14:46:17 2009
@@ -632,10 +632,12 @@
         // Do a projection query to verify the base values
 
         validateIndexAndValues(em, "BaseTestEntity", "one2Melems", 10000, 
-                new Object[] { elems[3], elems[4], elems[5]});
+                new Object[] { elems[3], elems[4], elems[5]}, "id", 
+                bte.getId());
 
         validateIndexAndValues(em, "BaseTestEntity", "m2melems", -50, 
-                new Object[] { elems[6], elems[7], elems[8]});
+                new Object[] { elems[6], elems[7], elems[8]}, "id",
+                bte.getId());
 
 // This test is disabled until INDEX projection supports element collections
 //        validateIndexAndValues(em, "BaseTestEntity", "collelems", 10, 
@@ -853,11 +855,14 @@
     }
     
     private void validateIndexAndValues(OpenJPAEntityManagerSPI em, 
-            String entity, String indexedCol, int base, Object[] objs) {
+            String entity, String indexedCol, int base, Object[] objs, String
+            idField, Object idValue) {
         String queryString = "SELECT INDEX(b), b FROM " + entity + " a JOIN a." +
-            indexedCol + " b";
+            indexedCol + " b WHERE a." + idField + " = :idVal";
         Query qry = em.createQuery(queryString);
-        List rlist = qry.getResultList();       
+        qry.setParameter("idVal", idValue);
+        List rlist = qry.getResultList();  
+        
         assertNotNull(rlist);
         assertEquals(rlist.size(), objs.length);        
         for (int i = 0; i < objs.length; i++)



Mime
View raw message