You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by an...@apache.org on 2007/10/02 15:03:16 UTC
svn commit: r581221 - /db/jdo/site/xdocs/why_jdo.xml
Author: andyj
Date: Tue Oct 2 06:03:16 2007
New Revision: 581221
URL: http://svn.apache.org/viewvc?rev=581221&view=rev
Log: (empty)
Added:
db/jdo/site/xdocs/why_jdo.xml
Added: db/jdo/site/xdocs/why_jdo.xml
URL: http://svn.apache.org/viewvc/db/jdo/site/xdocs/why_jdo.xml?rev=581221&view=auto
==============================================================================
--- db/jdo/site/xdocs/why_jdo.xml (added)
+++ db/jdo/site/xdocs/why_jdo.xml Tue Oct 2 06:03:16 2007
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<document>
+ <properties>
+ <title>Why JDO ?</title>
+ </properties>
+
+ <body>
+ <section name="Why JDO ?">
+ <p>
+ The majority of applications need to persist (or store) data during their lifecycle. There are many ways of doing
+ this with an application written in Java.
+ </p>
+ <p>
+ You can handle the persistence (and retrieval) of data yourself using <B>JDBC</B>. With <B>JDBC</B>, you have the burden
+ of having to write the persistence layer yourself. This gives much control, but also creates significant work, both in
+ writing the code but also in testing and maintenance.
+ </p>
+ <p>
+ You could also use <B>J2EE</B>, and persist data using Entity Beans. With <B>J2EE</B> you hand off the persistence of
+ your objects to the EJB part of the J2EE server. This simplifies things, but places a major restriction on your code
+ in that you have to write your objects as Entity Beans. In addition J2EE adds layers that are not necessarily required
+ for your application.
+ </p>
+ <p>
+ You can use a proprietary or non-standards compliant persistence framework like <B>TopLink</B>, or <B>Hibernate</B> and
+ persist your plain old Java objects. You will, however, be tied in to their API and be unable to easily move your system
+ to an alternative implementation.
+ </p>
+ <p>
+ Alternatively you can use <B>JDO</B>, a standardised persistence interface. With <B>JDO</B> you can take your plain
+ old Java objects and just persist them as they are. It is totally transparent and very little work is required by
+ the developer.
+ </p>
+ <p>
+ To give a <I>guide</I>, here are a few important consideration points when choosing a persistence layer for your application.
+ </p>
+
+ <table>
+ <tr>
+ <th>Feature</th>
+ <th>JDBC</th>
+ <th>Custom O/R (1)</th>
+ <th>EJB (2)</th>
+ <th>JDO</th>
+ <th>JPA</th>
+ </tr>
+ <tr>
+ <td>Standards-Driven and Portable</td>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Choice of datastores</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>Simple Java objects</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Out of box implementation (3)</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Usable in stand-alone application</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Usable in J2EE environment</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Simple to unit test</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Dynamic queries</td>
+ <td>Yes (4)</td>
+ <td>Yes</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Primary Key generation</td>
+ <td>Yes (4)</td>
+ <td>Yes</td>
+ <td>No (5)</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Supports inherited objects</td>
+ <td>Yes (4)</td>
+ <td>Yes</td>
+ <td>No (5)</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Automatic Creation of schema (top-down)</td>
+ <td>No</td>
+ <td>Yes</td>
+ <td>No (5)</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>Supports existing schema (bottom-up)</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ <td>Yes</td>
+ </tr>
+ </table>
+ <ol>
+ <li>refers to products such as Hibernate, TopLink which follow no standard.</li>
+ <li>refers to entity beans for EJB 2.*</li>
+ <li>refers to whether it is necessary to write the persistence yourself (e.g as with JDBC) or whether you can just
+ persist by simple calls.</li>
+ <li>requires the developer to write this layer.</li>
+ <li>some advanced EJB containers like Bea Weblogic and IBM Websphere provide support for primary key generation,
+ inherited objects and database schema creation as well.</li>
+ </ol>
+ </section>
+
+ </body>
+</document>