db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject svn commit: r434475 - /db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java
Date Thu, 24 Aug 2006 19:23:27 GMT
Author: brj
Date: Thu Aug 24 12:23:27 2006
New Revision: 434475

URL: http://svn.apache.org/viewvc?rev=434475&view=rev
Log:
testCase for bug OJB-120

Modified:
    db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java?rev=434475&r1=434474&r2=434475&view=diff
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/QueryTest.java Thu Aug 24 12:23:27 2006
@@ -597,6 +597,32 @@
     }
 
     /**
+     * test Subquery get all product groups containing Tofu
+     * testCase for bug OJB-120
+     * <p/>
+     * test may fail if db does not support sub queries
+     */
+    public void testSubQueryExists()
+    {
+        ReportQueryByCriteria subQuery;
+        Criteria subCrit = new Criteria();
+        Criteria crit = new Criteria();
+
+        subCrit.addEqualToField("productGroupId", Criteria.PARENT_QUERY_PREFIX + "groupId");
+        subCrit.addLike("articleName", "%Tofu%");
+        subQuery = QueryFactory.newReportQuery(Article.class, subCrit);
+        subQuery.setAttributes(new String[]{"articleId"});
+        subQuery.addOrderByAscending("articleId");
+
+        crit.addExists(subQuery);
+        Query q = QueryFactory.newQuery(ProductGroup.class, crit);
+
+        Collection results = broker.getCollectionByQuery(q);
+        assertNotNull(results);
+        assertEquals(1, results.size());
+    }
+
+    /**
      * test Like Criteria
      */
     public void testLikeCriteria()



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message