openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1580429 - in /openjpa/branches/2.2.1.x: ./ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/ openjpa-persistence-jdbc/src/test/java/org/a...
Date Sun, 23 Mar 2014 02:34:16 GMT
Author: hthomann
Date: Sun Mar 23 02:34:15 2014
New Revision: 1580429

URL: http://svn.apache.org/r1580429
Log:
OPENJPA-2475: A query with LEFT FETCH JOIN returns incorrect results - applied fix to 2.2.1.x

Added:
    openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/
      - copied from r1569528, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/
    openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/DepartmentTest.java
      - copied unchanged from r1569528, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/DepartmentTest.java
    openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/PersonTest.java
      - copied unchanged from r1569528, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/PersonTest.java
    openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/TestJoinLeftFetch.java
      - copied unchanged from r1569528, openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jpql/joins/leftfetch/TestJoinLeftFetch.java
Modified:
    openjpa/branches/2.2.1.x/   (props changed)
    openjpa/branches/2.2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
    openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java

Propchange: openjpa/branches/2.2.1.x/
------------------------------------------------------------------------------
  Merged /openjpa/branches/2.1.x:r1569528,1575444

Modified: openjpa/branches/2.2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java?rev=1580429&r1=1580428&r2=1580429&view=diff
==============================================================================
--- openjpa/branches/2.2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
(original)
+++ openjpa/branches/2.2.1.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
Sun Mar 23 02:34:15 2014
@@ -221,11 +221,7 @@ public abstract class StoreCollectionFie
                 joins = sel.outer(joins);
             if (!selectOid) {
                 Column[] refs = getJoinForeignKey(elem).getColumns();
-                if (requiresOrderBy()) {
-                    sel.orderBy(refs, true, joins, true);
-                } else {
-                    sel.select(refs, joins);
-                }
+                sel.orderBy(refs, true, joins, true);
             }
             field.orderLocal(sel, elem, joins);
         }
@@ -630,10 +626,6 @@ public abstract class StoreCollectionFie
         return getJoinForeignKey(getDefaultElementMapping(false));
     }
     
-    boolean requiresOrderBy() {
-    	return List.class.isAssignableFrom(field.getProxyType());
-    }
-    
     /**
      * Gets the identity value of the given instance that is suitable to join to the given
foreign key.
      * The special case of the foreign key being a relation identifier will encode the value.


Modified: openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java?rev=1580429&r1=1580428&r2=1580429&view=diff
==============================================================================
--- openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java
(original)
+++ openjpa/branches/2.2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/enhance/identity/TestMultipleLevelDerivedIdentity1.java
Sun Mar 23 02:34:15 2014
@@ -39,7 +39,16 @@ public class TestMultipleLevelDerivedIde
 	private static String BOOK_NAME    = "foo";
 	private static int    NUM_PAGES    = 3;
 	private static int    NUM_LINES    = 20;
+
     public void setUp() throws Exception {
+        setSupportedDatabases(org.apache.openjpa.jdbc.sql.DerbyDictionary.class,
+            org.apache.openjpa.jdbc.sql.DB2Dictionary.class, 
+            org.apache.openjpa.jdbc.sql.OracleDictionary.class);
+        
+        if (isTestsDisabled()) {
+            return;
+        }
+        
         super.setUp(DROP_TABLES, Library1.class, Book1.class, Page1.class,
             BookId1.class, PageId1.class, Line1.class, LineId1.class,
             "openjpa.RuntimeUnenhancedClasses", "unsupported");
@@ -215,7 +224,7 @@ public class TestMultipleLevelDerivedIde
         EntityManager em = emf.createEntityManager();
         Library1 lib = em.find(Library1.class, LIBRARY_NAME);
         assertNotNull(lib);
-        assertSQLFragnments(sql, "ORDER BY t1.LIBRARY_NAME ASC, t1.BOOK_NAME ASC");
+        assertSQLFragnments(sql, "ORDER BY", "t1.LIBRARY_NAME ASC, t1.BOOK_NAME ASC");
         em.close();
     }
     



Mime
View raw message