You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2006/06/18 02:12:11 UTC
svn commit: r415080 - in
/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs:
docu/faq.xml docu/guides/jdbc-types.xml docu/howtos/howto-use-lobs.xml
site.xml
Author: arminw
Date: Sat Jun 17 17:12:10 2006
New Revision: 415080
URL: http://svn.apache.org/viewvc?rev=415080&view=rev
Log:
adapt docs, advanced jdbc type
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/jdbc-types.xml
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/howtos/howto-use-lobs.xml
db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/site.xml
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml?rev=415080&r1=415079&r2=415080&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/faq.xml Sat Jun 17 17:12:10 2006
@@ -1116,13 +1116,27 @@
</answer>
</faq>
+ <faq id="supportedTypes">
+ <question>
+ Which JDBC data types are supported by OJB?
+ </question>
+ <answer>
+ <p>
+ Please refer to OJB's <a href="site:jdbc-types">jdbc-types section</a> for an
+ overview of supported data types and notes for advanced types.
+ </p>
+ </answer>
+ </faq>
+
<faq id="lobs">
<question>
- How to use LOB's with OJB?
+ How to use LOB's (like Blob and Clob) with OJB?
</question>
<answer>
<p>
- Please refer to OJB's <a href="site:use-lobs">LOB's howto</a>.
+ Please refer to OJB's <a href="site:use-lobs">LOB's howto</a> or to
+ <a href="site:jdbc-types">jdbc-types section</a> for an overview of supported
+ data types and notes for advanced types.
</p>
</answer>
</faq>
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/jdbc-types.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/jdbc-types.xml?rev=415080&r1=415079&r2=415080&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/jdbc-types.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/guides/jdbc-types.xml Sat Jun 17 17:12:10 2006
@@ -166,6 +166,45 @@
</table>
</section>
+ <anchor id="advanced-types"/>
+ <section>
+ <title>Advanced Data Types</title>
+ <p>
+ This section describes the handling of <em>advanced data types</em>.
+ </p>
+
+ <anchor id="advanced-types-lob"/>
+ <section>
+ <title>LOB content</title>
+ <p>
+ The handling of LOB-content (<code>java.sql.Blob</code> and <code>java.sql.Clob</code> fields
+ in persistence capable objects) is described in <a href="site:use-lobs">this how-to</a>.
+ </p>
+ </section>
+
+ <anchor id="advanced-types-java-object"/>
+ <section>
+ <title>Type JAVA_OBJECT</title>
+ <p>
+ Databases implement this type in different ways. Most of them realize storing of
+ Java objects via a serialized byte array. By default OJB use <code>PreparedStatement.setObject</code>
+ to store Java object fields of persistence capable objects and method <code>ResultSet.getObject</code>
+ or <code>CallableStatement.getObject</code> to read in JAVA_OBJECT database columns.
+ </p>
+ <p>
+ But many databases/jdbc-driver don't proper support type JAVA_OBJECT. In this case it's possible
+ to modify the database specific implementation class of interface
+ <a href="ext:platform"><code>org.apache.ojb.broker.platforms.Platform</code></a>.
+ <br/>
+ For example, many databases support storing of Java objects but return the persisted Java objects
+ as <code>byte[]</code>-array instead of the deserialized java object. In this case it's possible to
+ realise the correct behavior by modify the specific <code>Platform</code> implementation class
+ (e.g. MaxDB, MySQL need specific handling of JAVA_OBJECT result set columns).
+ </p>
+ </section>
+
+ </section>
+
<anchor id="field-conversion"/>
<section>
<title>Type and Value Conversions - the <code>FieldConversion</code> Interface</title>
@@ -520,7 +559,8 @@
</p>
<source><![CDATA[
<class-descriptor class="com.acme.VSJO" table="THE_DB_TABLE">
- <field-descriptor column="ID" name="id" jdbc-type="NUMERIC" primarykey="true" null-check="com.acme.ojb.NullCheckAcmeImpl" />
+ <field-descriptor column="ID" name="id" jdbc-type="NUMERIC"
+ primarykey="true" null-check="com.acme.ojb.NullCheckAcmeImpl" />
<field-descriptor column="TEXTDATA" name="textData" jdbc-type="VARCHAR" />
</class-descriptor>
]]></source>
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/howtos/howto-use-lobs.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/howtos/howto-use-lobs.xml?rev=415080&r1=415079&r2=415080&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/howtos/howto-use-lobs.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/docu/howtos/howto-use-lobs.xml Sat Jun 17 17:12:10 2006
@@ -331,8 +331,8 @@
<code>java.sql.Blob</code> and <code>java.sql.Clob</code> instances (provided by the jdbc-driver)
with wrapper classes (see class <a href="ext:blob-handle"><code>BlobHandle</code></a> and
<a href="ext:clob-handle"><code>ClobHandle</code></a>). These wrapper classes restrict the
- life of the wrapped LOB instances independent from the used database (except when using
- <a href="#reportQueries">Report Queries</a> to query LOB content).
+ life of the wrapped LOB instances independent from the used database (it's possible to
+ to <a href="#unwrap">bypass the wrapper classes</a>).
</p>
<p>
LOB fields behavior is different from <em>normal</em> fields.
@@ -423,11 +423,32 @@
<title>LOB content via <a href="site:query/report-queries">Report Query</a></title>
<p>
Using <a href="site:query/report-queries">Report Query</a> to lookup LOB content
- will return the <code>java.sql.Blob</code> and <code>java.sql.Clob</code> instances
- provided by the jdbc-driver - in contrast to persistence capable objects with LOB content
- OJB <strong>do not wrap</strong> these instances with specific
- <a href="#lifecycle">wrapper objects</a>.
+ don't differ from "normal" report queries. Only the returned <code>java.sql.Blob</code>
+ and <code>java.sql.Clob</code> instances provided by the jdbc-driver will be automatically
+ <a href="#lifecycle">wrapped by OJB</a>.
</p>
+ <p>
+ An example based on the <a href="#lobMapping">example mapping</a> above would
+ look like this:
+ </p>
+ <source><![CDATA[
+// precondition: active PersistenceBroker transaction
+Criteria crit = new Criteria();
+crit.addNotNull("blob");
+crit.addEqualTo("id", new Integer(obj.getId()));
+ReportQueryByCriteria q = QueryFactory.newReportQuery(LobObject.class, crit);
+q.setAttributes(new String[]{"blob", "clob"});
+Iterator result = broker.getReportQueryIteratorByQuery(q);
+while(result.hasNext())
+{
+ Object[] arr = (Object[]) result.next();
+ assertNotNull("BLOB expected", arr[0]);
+ assertNotNull("CLOB expected", arr[1]);
+ Blob bb = (Blob) arr[0];
+ Clob cc = (Clob) arr[1];
+ bb.length();
+ cc.length();
+}]]></source>
</section>
</section>
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/site.xml?rev=415080&r1=415079&r2=415080&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/site.xml (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/doc/forrest/src/documentation/content/xdocs/site.xml Sat Jun 17 17:12:10 2006
@@ -279,6 +279,7 @@
<lob-helper href="org/apache/ojb/broker/lob/LobHelper.html"/>
<blob-handle href="org/apache/ojb/broker/lob/BlobHandle.html"/>
<clob-handle href="org/apache/ojb/broker/lob/ClobHandle.html"/>
+ <platform href="org/apache/ojb/broker/platforms/Platform.html"/>
<!-- odmg-api classes -->
<odmg-transaction href="org/odmg/Transaction.html"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org