Author: arminw
Date: Thu Apr 5 17:12:37 2007
New Revision: 526012
URL: http://svn.apache.org/viewvc?view=rev&rev=526012
Log:
improvement
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml
URL:
http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml?view=diff&rev=526012&r1=526011&r2=526012
==============================================================================
---
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml
(original)
+++
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/query.xml
Thu Apr 5 17:12:37 2007
@@ -46,9 +46,8 @@
In this section you will learn how to use the
<em>Criteria-API</em>.
The classes are located in the package
<code>org.apache.ojb.broker.query</code>.
- Using query by criteria you can either
- <a href="#querying-for-objects">query for whole objects</a>
- (ie. person) or you can use
+ Using query by criteria you can either query for whole objects
+ (ie. Person class objects) or you can use
<a href="#report-queries">report queries</a> returning row
data.
</p>
<p>
@@ -760,22 +759,6 @@
</p>
</section>
-
- <anchor id="querying-for-objects"/>
- <section>
- <title>querying for objects</title>
- <p>
- OJB queries return
- <strong>complete</strong> objects, that means all instance
variables are filled
- and all 'auto-retrieve' relationships are loaded. Currently
there's no way to retrieve partially
- loaded objects (ie. only first- and lastname of a person).
- </p>
- <p>
- More info about <a href="site:metadata">manipulation of
metadata setting here</a>.
- </p>
- </section>
-
-
<anchor id="query-by-identity"/>
<section>
<title>find by Primary Key (by <code>Identity</code>)</title>
@@ -794,6 +777,30 @@
</p>
</section>
+ <anchor id="partially-materialized-objects"/>
+ <section>
+ <title>querying partially materialized objects</title>
+ <p>
+ Currently there's no way to retrieve partially loaded
objects (ie. a Person class object
+ only populated with 'lastname' and all other fields not
populated). OJB queries return always
+ <strong>complete</strong> objects, that means all instance
variables are filled and all
+ <a
href="site:basic-technique/auto-retrieve">'auto-retrieve' relationships</a>
+ are loaded or populated with proxy placeholder.
+ </p>
+ <p>
+ To retrieve sub-sets of persistent object fields OJB
provide a specific field/column based
+ query: The <a href="#report-query">report query</a>.
+ </p>
+ <p>
+ If this doesn't fit your need it's possible to deal with
different metadata profiles. Then it's
+ possible to define different mappings for the same object
(e.g. a full Person class mapping, in
+ the other mapping profile only 'firstname' and 'lastname'
is mapped).
+ More info about <a href="site:metadata">manipulation of
metadata settings and how to manage different
+ metadata profiles here</a>.
+ </p>
+ </section>
+
+
<anchor id="report-queries"/>
<section>
@@ -816,8 +823,7 @@
ReportQueryByCriteria q = QueryFactory.newReportQuery(Article.class, crit);
q.setAttributes(new String[] { "productGroup.groupName","articleId",
"articleName", "price" });
-Iterator iter = broker.getReportQueryIteratorByQuery(q);
-]]></source>
+Iterator iter = broker.getReportQueryIteratorByQuery(q);]]></source>
<p>
The ReportQuery returns an Iterator over a Collection of
Object[4] ([String, Integer, String, Double]).
@@ -837,8 +843,7 @@
"groupName", "sum(allArticlesInGroup.stock)",
"sum(allArticlesInGroup.price)" });
q.addGroupBy("groupName");
-Iterator iter = broker.getReportQueryIteratorByQuery(q);
-]]></source>
+Iterator iter = broker.getReportQueryIteratorByQuery(q);]]></source>
<p>
The ReportQuery looks quite reasonable,
but it will produce an SQL not suitable for the task:
</p>
@@ -939,7 +944,7 @@
Object o = it.next();
System.out.println("result: " + ArrayUtils.toString(o));
}
- ]]></source>
+]]></source>
<note>
OJB use the <code>ResultSetMetaData</code> to
determine the correct
SQL type of the <code>ResultSet</code> values, so this
feature requires
@@ -982,7 +987,7 @@
q.setWithExtents(false);
q.setEndAtIndex(1);
Iterator it = broker.getReportQueryIteratorByQuery(q);
- ]]></source>
+]]></source>
<p>
The first query asks for all routes with the absolute
deviation (is field of class Route) of ten.
</p>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]