openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r788903 - in /openjpa/branches/subquery: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/ openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ openjpa-kernel/src...
Date Fri, 26 Jun 2009 23:29:59 GMT
Author: fancy
Date: Fri Jun 26 23:29:58 2009
New Revision: 788903

URL: http://svn.apache.org/viewvc?rev=788903&view=rev
Log:
fix for subqueries in TestEmbeddable 

Modified:
    openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
    openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
    openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java
    openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
    openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Magazine_.java
    openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Publisher_.java

Modified: openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
URL: http://svn.apache.org/viewvc/openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java?rev=788903&r1=788902&r2=788903&view=diff
==============================================================================
--- openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
(original)
+++ openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/exps/PCPath.java
Fri Jun 26 23:29:58 2009
@@ -497,9 +497,8 @@
                     isCorrelatedPath = 
                         pstate.joins.isCorrelatedVariable(action.var);
                 }
-                if (!isCorrelatedPath)
-                    pstate.joins = pstate.joins.
-                        setVariable((String) action.data);
+                pstate.joins = pstate.joins.
+                    setVariable((String) action.data);
             }
             else if (action.op == Action.SUBQUERY) {
                 pstate.joins = pstate.joins.setSubselect((String) action.data);

Modified: openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=788903&r1=788902&r2=788903&view=diff
==============================================================================
--- openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
(original)
+++ openjpa/branches/subquery/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
Fri Jun 26 23:29:58 2009
@@ -2608,10 +2608,9 @@
 
         public boolean isCorrelatedVariable(String var) {
             boolean isCorrelated = getSelect().ctx().getVariable(var) == null;
-            if (isCorrelated) {
-                setVariable(var);
+            if (isCorrelated)
                 this.correlatedVar = var;
-            }
+
             return isCorrelated;
         }
 

Modified: openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java?rev=788903&r1=788902&r2=788903&view=diff
==============================================================================
--- openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java
(original)
+++ openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/AbstractExpressionBuilder.java
Fri Jun 26 23:29:58 2009
@@ -156,6 +156,10 @@
      * Returns a value for the given id.
      */
     protected Value getVariable(String id, boolean bind) {
+        // check for already constructed var
+        if (isSeenVariable(id))
+            return (Value) _seenVars.get(id);
+
         // create and cache var
         Class<?> type = getDeclaredVariableType(id);
 

Modified: openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=788903&r1=788902&r2=788903&view=diff
==============================================================================
--- openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
(original)
+++ openjpa/branches/subquery/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
Fri Jun 26 23:29:58 2009
@@ -794,10 +794,7 @@
         if (id == null)
             return null;
 
-        if (bind)
-            return super.getVariable(id.toLowerCase(), bind);
-        else
-            return ctx().findVariable(id);
+        return super.getVariable(id.toLowerCase(), bind);
     }
 
     protected Value getDefinedVariable(String id) {
@@ -1564,14 +1561,14 @@
         if (cmd != null) {
             // handle the case where the class name is the alias
             // for the candidate (we don't use variables for this)
-            Value thiz = factory.getThis();
-//            Value thiz = null;
-//            if (ctx().subquery == null || 
-//                ctx().getSchema(name.toLowerCase()) == null) {
-//                thiz = factory.getThis();
-//            } else {
-//                thiz = factory.newPath(ctx().subquery);
-//            }
+            //Value thiz = factory.getThis();
+            Value thiz = null;
+            if (ctx().subquery == null || 
+                ctx().getSchema(name.toLowerCase()) == null) {
+                thiz = factory.getThis();
+            } else {
+                thiz = factory.newPath(ctx().subquery);
+            }
             ((Path)thiz).setSchemaAlias(name);
             thiz.setMetaData(cmd);
             return thiz;

Modified: openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Magazine_.java
URL: http://svn.apache.org/viewvc/openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Magazine_.java?rev=788903&r1=788902&r2=788903&view=diff
==============================================================================
--- openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Magazine_.java
(original)
+++ openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Magazine_.java
Fri Jun 26 23:29:58 2009
@@ -14,5 +14,4 @@
     public static volatile SingularAttribute<Magazine,Integer> id;
     public static volatile SingularAttribute<Magazine,Publisher> idPublisher;
     public static volatile SingularAttribute<Magazine,String> name;
-    public static volatile SingularAttribute<Magazine,Long> serialVersionUID;
 }

Modified: openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Publisher_.java
URL: http://svn.apache.org/viewvc/openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Publisher_.java?rev=788903&r1=788902&r2=788903&view=diff
==============================================================================
--- openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Publisher_.java
(original)
+++ openjpa/branches/subquery/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/Publisher_.java
Fri Jun 26 23:29:58 2009
@@ -13,5 +13,4 @@
     public static volatile SingularAttribute<Publisher,Integer> id;
     public static volatile SetAttribute<Publisher,Magazine> magazineCollection;
     public static volatile SingularAttribute<Publisher,String> name;
-    public static volatile SingularAttribute<Publisher,Long> serialVersionUID;
 }



Mime
View raw message