openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r691421 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
Date Tue, 02 Sep 2008 23:07:22 GMT
Author: ppoddar
Date: Tue Sep  2 16:07:22 2008
New Revision: 691421

URL: http://svn.apache.org/viewvc?rev=691421&view=rev
Log:
OPENJPA-710: Do not add ORDER BY clause for unordered collection field. But select the field
as it is expecetd subsequently for loading.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java?rev=691421&r1=691420&r2=691421&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/StoreCollectionFieldStrategy.java
Tue Sep  2 16:07:22 2008
@@ -226,7 +226,11 @@
                 joins = sel.outer(joins);
             if (!selectOid) {
                 Column[] refs = getJoinForeignKey(elem).getColumns();
-                sel.orderBy(refs, true, joins, true);
+                if (requiresOrderBy()) {
+                    sel.orderBy(refs, true, joins, true);
+                } else {
+                    sel.select(refs, joins);
+                }
             }
             field.orderLocal(sel, elem, joins);
         }
@@ -662,4 +666,8 @@
     protected ForeignKey getJoinForeignKey() {
         return getJoinForeignKey(getDefaultElementMapping(false));
     }
+    
+    boolean requiresOrderBy() {
+    	return List.class.isAssignableFrom(field.getProxyType());
+    }
 }



Mime
View raw message