openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r727775 - 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 Thu, 18 Dec 2008 17:36:19 GMT
Author: mikedd
Date: Thu Dec 18 09:36:18 2008
New Revision: 727775

URL: http://svn.apache.org/viewvc?rev=727775&view=rev
Log:
OPENJPA-708 merge to 1.2.x

Modified:
    openjpa/branches/1.2.x/   (props changed)
    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

Propchange: openjpa/branches/1.2.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Dec 18 09:36:18 2008
@@ -1 +1 @@
-/openjpa/trunk:708722
+/openjpa/trunk:690823,708722

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=727775&r1=727774&r2=727775&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 Dec 18 09:36:18 2008
@@ -577,7 +577,10 @@
         
         if (_parent.getAliases() == null || _subPath == null)
             return;
-        
+
+        if (_parent._aliases.size() <= 1)
+            return;
+ 
         // resolve aliases for subselect from parent
         Set<Map.Entry> entries = _parent.getAliases().entrySet();
         for (Map.Entry entry : entries) {

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=727775&r1=727774&r2=727775&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 Dec 18 09:36:18 2008
@@ -32,7 +32,8 @@
 
     public void setUp() {
         setUp(Customer.class, Customer.CustomerKey.class,
-            Order.class, OrderItem.class, CLEAR_TABLES);
+            Order.class, OrderItem.class,
+            Magazine.class, Publisher.class, CLEAR_TABLES);
     }
 
     static String[]  querys = new String[] {
@@ -68,6 +69,16 @@
             " (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)",
+        "SELECT p, m "+
+            "FROM Publisher p "+
+            "LEFT OUTER JOIN p.magazineCollection m "+
+            "WHERE m.id = (SELECT MAX(m2.id) "+
+            "FROM Magazine m2 "+
+            "WHERE m2.idPublisher.id = p.id "+
+            "AND m2.datePublished = "+
+            "(SELECT MAX(m3.datePublished) "+
+            "FROM Magazine m3 "+
+            "WHERE m3.idPublisher.id = p.id)) ", 
     // 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