openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r906614 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/
Date Thu, 04 Feb 2010 19:38:28 GMT
Author: faywang
Date: Thu Feb  4 19:38:27 2010
New Revision: 906614

URL: http://svn.apache.org/viewvc?rev=906614&view=rev
Log:
OPENJPA-1493: performance fix in getTableIndex

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/Select.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestTypesafeCriteria.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java?rev=906614&r1=906613&r2=906614&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/SelectConstructor.java
Thu Feb  4 19:38:27 2010
@@ -166,7 +166,9 @@
                 subsel.setParent(sel, subquery.getCandidateAlias());
             }
         }
-     
+        if (HasContainsExpressionVisitor.hasContains(exps.filter)) {
+            sel.setHasSubselect(true);
+        }
         initialize(sel, ctx, exps, state);
 
         if (!sel.getAutoDistinct()) {

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java?rev=906614&r1=906613&r2=906614&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/LogicalUnion.java
Thu Feb  4 19:38:27 2010
@@ -443,6 +443,14 @@
             throw new UnsupportedException(_loc.get("union-element"));
         }
 
+        public void setHasSubselect(boolean hasSub) {
+            sel.setHasSubselect(hasSub);
+        }
+        
+        public boolean getHasSubselect() {
+            return sel.getHasSubselect();    
+        }
+        
         public Select getFromSelect() {
             return null;
         }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/Select.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/Select.java?rev=906614&r1=906613&r2=906614&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/Select.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/Select.java Thu Feb
 4 19:38:27 2010
@@ -719,4 +719,18 @@
      * @param schemaAlias
      */
     public void setSchemaAlias(String schemaAlias);
+    
+    /**
+     * Set the flag to indicate whether this Select has
+     * internally generated subselect 
+     */
+    public void setHasSubselect(boolean hasSub);
+    
+    /**
+     * Return the flag to indicate whether this Select has
+     * internally generated subselect
+     * @return
+     */
+    public boolean getHasSubselect();
+   
 }

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=906614&r1=906613&r2=906614&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java (original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java Thu
Feb  4 19:38:27 2010
@@ -158,6 +158,7 @@
     private List _subsels = null;
     private SelectImpl _parent = null;
     private String _subPath = null;
+    private boolean _hasSub = false;
 
     // from select if this select selects from a tmp table created by another
     private SelectImpl _from = null;
@@ -559,6 +560,14 @@
         }
     }
     
+    public void setHasSubselect(boolean hasSub) {
+        _hasSub = hasSub;
+    }
+    
+    public boolean getHasSubselect() {
+        return _hasSub;    
+    }
+    
     public Map getAliases() {
         return _aliases;
     }
@@ -1990,8 +1999,9 @@
         if (pj != null && pj.path() != null)
             key = new Key(pj.path().toString(), key);
 
-        if (_ctx != null && (_parent != null || _subsels != null))
+        if (_ctx != null && (_parent != null || _subsels != null || _hasSub)) {
             i = findAliasForQuery(table, pj, key, create);
+        }
 
         if (i != null)
             return i.intValue();

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestTypesafeCriteria.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestTypesafeCriteria.java?rev=906614&r1=906613&r2=906614&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestTypesafeCriteria.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestTypesafeCriteria.java
Thu Feb  4 19:38:27 2010
@@ -1161,7 +1161,6 @@
         executeAndCompareSQL(q, sql);
     }
 
-    @AllowFailure(message="The expected sql string is incorrect")
     public void testValues5() {
         String sql = "SELECT t0.name, t2.id, t2.label FROM CR_ITEM t0 "
             + "INNER JOIN CR_ITEM_photos t1 ON t0.id = t1.ITEM_ID "



Mime
View raw message