openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r683877 - in /openjpa/branches/1.2.x: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubquery.java
Date Fri, 08 Aug 2008 06:46:41 GMT
Author: fancy
Date: Thu Aug  7 23:46:40 2008
New Revision: 683877

URL: http://svn.apache.org/viewvc?rev=683877&view=rev
Log:
OPENJPA-681 Subquery generates SQL with syntax error

Modified:
    openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
    openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubquery.java

Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java?rev=683877&r1=683876&r2=683877&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
(original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/SelectImpl.java
Thu Aug  7 23:46:40 2008
@@ -618,8 +618,10 @@
         // if alias is defined and referenced, return true.
         String value = "t" + alias.toString() + ".";
         if (_tableAliases != null)
-            return _tableAliases.containsValue(value) &&
-               _tables.containsKey(alias);
+            if (_tableAliases.containsValue(value))
+               return _tables.containsKey(alias);
+           else
+               return _joins != null;
         else
             return true;
     }

Modified: openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubquery.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubquery.java?rev=683877&r1=683876&r2=683877&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubquery.java
(original)
+++ openjpa/branches/1.2.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSubquery.java
Thu Aug  7 23:46:40 2008
@@ -66,6 +66,8 @@
             " and (select min(o2.amount) from Customer c, in(c.orders) o2)",
         "select o.oid from Customer c, in(c.orders)o where o.amount >" +
             " (select sum(o2.amount) from c.orders o2)",
+        "select o1.oid, c.name from Order o1, Customer c where o1.amount = " +
+            " any(select o2.amount from in(c.orders) o2)",
     // outstanding problem subqueries:
     //"select o from Order o where o.amount > (select count(o) from Order o)",
     //"select o from Order o where o.amount > (select count(o2) from Order o2)",



Mime
View raw message