Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 98687 invoked from network); 9 Apr 2005 13:21:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Apr 2005 13:21:22 -0000 Received: (qmail 93827 invoked by uid 500); 9 Apr 2005 13:21:21 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 93795 invoked by uid 500); 9 Apr 2005 13:21:21 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 93782 invoked by uid 500); 9 Apr 2005 13:21:21 -0000 Received: (qmail 93779 invoked by uid 99); 9 Apr 2005 13:21:21 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Sat, 09 Apr 2005 06:21:20 -0700 Received: (qmail 98673 invoked by uid 1513); 9 Apr 2005 13:21:19 -0000 Date: 9 Apr 2005 13:21:19 -0000 Message-ID: <20050409132119.98672.qmail@minotaur.apache.org> From: brj@apache.org To: db-ojb-cvs@apache.org Subject: cvs commit: db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides query.xml X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N brj 2005/04/09 06:21:19 Modified: src/doc/forrest/src/documentation/content/xdocs/docu/guides query.xml Log: short description of ReportQuery#setJdbcTypes Revision Changes Path 1.5 +33 -9 db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml Index: query.xml =================================================================== RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- query.xml 9 Apr 2005 12:52:25 -0000 1.4 +++ query.xml 9 Apr 2005 13:21:19 -0000 1.5 @@ -188,9 +188,9 @@ Instead of using the primary keys of an object as a selection criterion, addEqualToIdentity supports the whole Identity. This feature leads to more readable queries and is useful, when the object has multiple pk.

-

+

The following sample looks for projects of a given person. When querying for simple attributes we would use - crit.addEqualTo("persons.id", personId); where id is the primary key of person. + crit.addEqualTo("persons.id", personId); where id is the primary key of person. Criteria#addEqualToIdentity accepts the whole Identity and translates it into an addEqualTo() for each primary key.

#setAttributes(String[] attributes). + To define the attributes use ReportQuery#setAttributes(String[] attributes).

The following ReportQuery retrieves the name of the ProductGroup, the name of the Article etc. for all @@ -687,15 +686,40 @@ Object[4] ([String, Integer, String, Double]).

+
+ Defining the type of the returned data +

+ In the above example the ReportQuery returned a Collection of [String, Integer, String, Double]. The types of the returned + data are defined by the Metadata of the underlying Resultset. OJB lets you control the type of the returned data of ReportQueries + with the method ReportQuery#setJdbcTypes(int[] jdbcTypes). + SetJdbcTypes expects a type for each selected attributes. +

+ + +
+
Limitations of Report Queries

- ReportQueries currently only support simple arithmetic expressions (ie. price * 1.05). - Expressions based on multiple attributes (ie. price - bonus) do not work. + ReportQueries (OJB 1.0.x) only support simple arithmetic expressions (ie. price * 1.05). + In OJB 1.1 the support for expressions based on multiple attributes (ie. price - bonus) has been extended, + but they only work when all attributes belong to the same class. + This limitation applies to all QueryByCriteria.

- ReportQueries should not be used with columns referencing classes with extents. Assume we want to select all ProductGroups - and summarize the amount and prize of items in stock per group. The class Article referenced by allArticlesInGroup has the extents Books and CDs. + ReportQueries are not extent aware and should therefore not be used with columns referencing classes with extents. + Assume we want to select all ProductGroups and summarize the amount and prize of items in stock per group. + The class Article referenced by allArticlesInGrouphas the extents Books and CDs.