openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r886685 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql: DBDictionary.java MySQLDictionary.java
Date Thu, 03 Dec 2009 06:36:38 GMT
Author: faywang
Date: Thu Dec  3 06:36:36 2009
New Revision: 886685

URL: http://svn.apache.org/viewvc?rev=886685&view=rev
Log:
OPENJPA-459: fix bulkUpdate for DB2

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=886685&r1=886684&r2=886685&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Thu Dec  3 06:36:36 2009
@@ -1986,7 +1986,7 @@
         // (SELECT 1 FROM TABLE t0 WHERE t0.ID = TABLE.ID); also, some
         // databases do not allow aliases in delete statements, which
         // also causes us to use a subselect
-        Set<String> selectedTables = getSelectTableAliases(sel);
+        Collection<String> selectedTables = getSelectTableAliases(sel);
         if (selectedTables.size() == 1 && supportsSubselect
             && allowsAliasInBulkClause) {
             SQLBuffer from;
@@ -2070,14 +2070,8 @@
         return sql;
     }
     
-    Set<String> getSelectTableAliases(Select sel) {
-        Set<String> result = new HashSet<String>();
-        List<String> selects = sel.getIdentifierAliases();
-        for (String s : selects) {
-            String tableAlias = s.substring(0, s.indexOf('.'));
-            result.add(tableAlias);
-        }
-        return result;
+    protected Collection<String> getSelectTableAliases(Select sel) {
+        return sel.getTableAliases();
     }
 
     protected SQLBuffer getDeleteTargets(Select sel) {

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java?rev=886685&r1=886684&r2=886685&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/MySQLDictionary.java
Thu Dec  3 06:36:36 2009
@@ -24,6 +24,10 @@
 import java.sql.SQLException;
 import java.sql.Types;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
@@ -383,4 +387,15 @@
             select += " " + hint;
         return select;
     }
+    
+    @Override
+    protected Collection<String> getSelectTableAliases(Select sel) {
+        Set<String> result = new HashSet<String>();
+        List<String> selects = sel.getIdentifierAliases();
+        for (String s : selects) {
+            String tableAlias = s.substring(0, s.indexOf('.'));
+            result.add(tableAlias);
+        }
+        return result;
+    }
 }



Mime
View raw message