Return-Path: Delivered-To: apmail-db-jdo-commits-archive@www.apache.org Received: (qmail 98967 invoked from network); 3 Oct 2007 06:23:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Oct 2007 06:23:31 -0000 Received: (qmail 92548 invoked by uid 500); 3 Oct 2007 06:23:14 -0000 Mailing-List: contact jdo-commits-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-commits@db.apache.org Received: (qmail 92526 invoked by uid 99); 3 Oct 2007 06:23:14 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Oct 2007 23:23:14 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2007 06:23:11 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0AFBF1A983A; Tue, 2 Oct 2007 23:22:21 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r581505 [2/4] - in /db/jdo/site: docs/ docs/articles/ docs/guides/ docs/releases/ docs/tutorials/ xdocs/ xdocs/articles/ xdocs/guides/ xdocs/tutorials/ Date: Wed, 03 Oct 2007 06:22:15 -0000 To: jdo-commits@db.apache.org From: andyj@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071003062221.0AFBF1A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: db/jdo/site/docs/guides/replication.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/guides/replication.html?rev=581505&view=auto ============================================================================== --- db/jdo/site/docs/guides/replication.html (added) +++ db/jdo/site/docs/guides/replication.html Tue Oct 2 23:22:12 2007 @@ -0,0 +1,142 @@ +Java Data Objects (JDO) - Tutorial : Datastore Replication

Data Replication

+ There are times when you need to replicate data between datastores. In many cases datastores themselves provide a means of doing this, however if you want to avoid using datastore-specific functionality you can utilise JDO to perform this task. + JDO2 allows replication by use of detach/attach functionality. + We demonstrate this with an example +

+
+public class ElementHolder
+{
+    long id;
+    private Set elements = new HashSet();
+
+    ...
+}
+
+public class Element
+{
+    String name;
+
+    ...
+}
+
+public class SubElement extends Element
+{
+    double value;
+
+    ...
+}
+

+ so we have a 1-N unidirectional (Set) relation, and we define the metadata like this +

+
+<jdo>
+    <package name="org.apache.jdo.test">
+        <class name="ElementHolder" identity-type="application" detachable="true">
+            <inheritance strategy="new-table"/>
+            <field name="id" primary-key="true"/>
+            <field name="elements" persistence-modifier="persistent">
+                <collection element-type="Element"/>
+                <join/>
+            </field>
+        </class>
+
+        <class name="Element" identity-type="application" detachable="true">
+            <inheritance strategy="new-table"/>
+            <field name="name" primary-key="true"/>
+        </class>
+
+        <class name="SubElement">
+            <inheritance strategy="new-table"/>
+            <field name="value"/> 
+        </class>
+    </package>
+</jdo>
+

+ and so in our application we create some objects in datastore1, like this +

+
+PersistenceManagerFactory pmf1 = JDOHelper.getPersistenceManagerFactory("jdo.1.properties");
+PersistenceManager pm1 = pmf1.getPersistenceManager();
+Transaction tx1 = pm1.currentTransaction();
+Object holderId = null;
+try
+{
+    tx1.begin();
+
+    ElementHolder holder = new ElementHolder(101);
+    holder.addElement(new Element("First Element"));
+    holder.addElement(new Element("Second Element"));
+    holder.addElement(new SubElement("First Inherited Element"));
+    holder.addElement(new SubElement("Second Inherited Element"));
+    pm1.makePersistent(holder);
+
+    tx1.commit();
+    holderId = JDOHelper.getObjectId(holder);
+}
+finally
+{
+    if (tx1.isActive())
+    {
+        tx1.rollback();
+    }
+    pm1.close();
+}
+

+ and now we want to replicate these objects into datastore2, so we detach them from datastore1 + and attach them to datastore2, like this +

+
+// Detach the objects from "datastore1"
+ElementHolder detachedHolder = null;
+pm1 = pmf1.getPersistenceManager();
+tx1 = pm1.currentTransaction();
+try
+{
+    pm1.getFetchPlan().setGroups(new String[] {FetchPlan.DEFAULT, FetchPlan.ALL});
+    pm1.getFetchPlan().setMaxFetchDepth(-1);
+
+    tx1.begin();
+
+    ElementHolder holder = (ElementHolder) pm1.getObjectById(holderID);
+    detachedHolder = (ElementHolder) pm1.detachCopy(holder);
+
+    tx1.commit();
+}
+finally
+{
+    if (tx1.isActive())
+    {
+        tx1.rollback();
+    }
+    pm1.close();
+}
+
+// Attach the objects to datastore2
+PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory("jdo.2.properties");
+PersistenceManager pm2 = pmf2.getPersistenceManager();
+Transaction tx2 = pm2.currentTransaction();
+try
+{
+    tx2.begin();
+
+    pm2.makePersistent(detachedHolder);
+
+    tx2.commit();
+}
+finally
+{
+    if (tx2.isActive())
+    {
+        tx2.rollback();
+    }
+    pm2.close();
+}
+

+ These objects are now replicated into datastore2. + Clearly you can extend this basic idea and replicate large amounts of data. +


\ No newline at end of file Modified: db/jdo/site/docs/impls.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/impls.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/impls.html (original) +++ db/jdo/site/docs/impls.html Tue Oct 2 23:22:12 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - JDO Implementations

JDO Implementations

+ @import url("./style/maven-theme.css");

JDO Implementations

To build and run your JDO application, you need a JDO implementation. This page lists commercial and non-commercial JDO implementations. For information on how vendors certify compliance with the JDO 2 specification, see TCK. @@ -47,5 +47,5 @@ TJDO


Modified: db/jdo/site/docs/index.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/index.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/index.html (original) +++ db/jdo/site/docs/index.html Tue Oct 2 23:22:12 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - Home

About Apache JDO

+ @import url("./style/maven-theme.css");

About Apache JDO

Welcome to Apache JDO, a project of the Apache DB project. Our goal is a thriving community of users and developers of object persistence technology. @@ -67,5 +67,5 @@

Archived articles are here.


Modified: db/jdo/site/docs/issue-tracking.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/issue-tracking.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/issue-tracking.html (original) +++ db/jdo/site/docs/issue-tracking.html Tue Oct 2 23:22:12 2007 @@ -1,8 +1,8 @@ Java Data Objects (JDO) - Issue Tracking

Issue Tracking

+ @import url("./style/maven-theme.css");


Modified: db/jdo/site/docs/issuetracking.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/issuetracking.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/issuetracking.html (original) +++ db/jdo/site/docs/issuetracking.html Tue Oct 2 23:22:12 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - Issue Tracking

Process

+ @import url("./style/maven-theme.css");

Process

The JDO project uses JIRA to track issues.

We use the following workflow for our JIRA issues: @@ -22,5 +22,5 @@ Release Notes for released versions


Modified: db/jdo/site/docs/javadoc.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/javadoc.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/javadoc.html (original) +++ db/jdo/site/docs/javadoc.html Tue Oct 2 23:22:12 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - JDO Javadoc

Javadoc Formats

+ @import url("./style/maven-theme.css");

Javadoc Formats

JDO Javadoc is available in two formats. You can browse the javadoc online, or you can download it as a .zip file and unzip it to a local directory. @@ -10,5 +10,5 @@

JDO 1.1 javadoc

JDO 1.1 is the Apache JDO implementation of JSR-12.

Browse JDO 1.1 javadoc online

Download JDO 1.1 javadoc


Modified: db/jdo/site/docs/jdo_dtd.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/jdo_dtd.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/jdo_dtd.html (original) +++ db/jdo/site/docs/jdo_dtd.html Tue Oct 2 23:22:12 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - JDO DTD

Meta-Data - JDO

+ @import url("./style/maven-theme.css");

Meta-Data - JDO

JDO2 defines XML MetaData in jdo files as well as orm files. As always with XML, the metadata must match the defined DTD/XSD for that file type. This section describes the content of the jdo files. @@ -32,5 +32,5 @@ Your MetaData should match either the DTD or the XSD specification.


Modified: db/jdo/site/docs/jdo_v_jpa.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/jdo_v_jpa.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/jdo_v_jpa.html (original) +++ db/jdo/site/docs/jdo_v_jpa.html Tue Oct 2 23:22:12 2007 @@ -1,7 +1,7 @@ Java Data Objects (JDO) - JDO .v. JPA

Which Persistence Specification ?

+ @import url("./style/maven-theme.css");

Which Persistence Specification ?

There are several competing persistence technologies available for Java. Two of these are "standardised" (via the JCP). When developing your application you need to choose the most appropriate technology for your needs. Java Data Objects (JDO) has been a standard since 2001 with the release of JDO1. It was @@ -31,5 +31,5 @@ As an overall conclusion "JPA1" is a subset of what is already available in "JDO2". "JDO2.1" adds on some of the few new features found in "JPA1".


Modified: db/jdo/site/docs/jdo_v_jpa_orm.html URL: http://svn.apache.org/viewvc/db/jdo/site/docs/jdo_v_jpa_orm.html?rev=581505&r1=581504&r2=581505&view=diff ============================================================================== --- db/jdo/site/docs/jdo_v_jpa_orm.html (original) +++ db/jdo/site/docs/jdo_v_jpa_orm.html Tue Oct 2 23:22:12 2007 @@ -1,11 +1,11 @@ Java Data Objects (JDO) - JDO .v. JPA : Object/Relational Mapping

Which ORM specification ?

+ @import url("./style/maven-theme.css");

Which ORM specification ?

There are 2 prevalent specification in the Java ORM world. JDO2 provides the most complete definition, whilst JPA is the most recent. In this guide we show the different types of ORM relation commonly used, and mark against it which specification supports it. This list is not yet complete but will be added to to provide a comprehensive list of relationship type and where you can find it.

Field TypeRelationJDO2JPA1
PC1-1 Unidirectional
PC1-1 Bidirectional
PC1-1 serialised
PC1-1 CompoundIdentity Unidirectional
Interface1-1 Unidirectional
Interface1-1 Bidirectional
Interface1-1 serialised?
Collection<PC>1-N ForeignKey Unidirectional Collection
Collection<PC>1-N ForeignKey Bidirectional Collection
Collection<PC>1-N JoinTable Unidirectional Collection
Collection<PC>1-N JoinTable Bidirectional Collection
Collection<Non-PC>1-N JoinTable Collection
Collection<PC>1-N JoinTable Collection using shared JoinTable
Collection<PC>1-N ForeignKey Collection using shared ForeignKey
Collection<PC> ;M-N JoinTable
Collection<PC>1-N CompoundIdentity Unidirectional
Collection<PC>1-N serialised Collection
Collection<PC>1-N JoinTable Collection of serialised elements
List<PC>1-N ForeignKey Unidirectional Indexed List
List<PC>1-N ForeignKey Bidirectional Indexed List
List<PC>1-N JoinTable Unidirectional Indexed List
List<PC>1-N JoinTable Bidirectional Indexed List
List<Non-PC>1-N JoinTable Indexed List
List<PC>1-N ForeignKey Unidirectional Ordered List
List<PC>1-N ForeignKey Bidirectional Ordered List
List<PC>1-N JoinTable Unidirectional Ordered List
List<PC>1-N JoinTable Bidirectional Ordered List
Map<PC, PC>1-N JoinTable Map
Map<N on-PC, PC>1-N JoinTable Map
Map<PC, Non-PC>1-N JoinTable Map
Map<Non-PC, Non-PC>1-N JoinTable Map
Map<Non-PC, PC>1-N ForeignKey Map Unidirectional (key stored in value)
Map<Non-PC, PC>1-N ForeignKey Map Bidirectional (key stored in value)
Map<PC, Non-PC>1-N ForeignKey Map Unidirectional (value stored in key)
Map<PC, PC>1-N serialised Map
Map<PC, PC>1-N JoinTable Map of serialised keys/values
PC[ ]1-N ForeignKey Unidirectional Array
PC[ ]1-N JoinTable Unidirectional Array
PC[ ]1-N serialised Array
Non-PC[ ]1-N JoinTable Unidirectional Array