You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by bu...@apache.org on 2013/04/21 18:21:09 UTC

svn commit: r859343 - in /websites/staging/isis/trunk: cgi-bin/ content/ content/components/objectstores/jdo/about.html content/components/objectstores/jdo/workarounds.html content/documentation.html

Author: buildbot
Date: Sun Apr 21 16:21:09 2013
New Revision: 859343

Log:
Staging update by buildbot for isis

Added:
    websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html
Modified:
    websites/staging/isis/trunk/cgi-bin/   (props changed)
    websites/staging/isis/trunk/content/   (props changed)
    websites/staging/isis/trunk/content/components/objectstores/jdo/about.html
    websites/staging/isis/trunk/content/documentation.html

Propchange: websites/staging/isis/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Apr 21 16:21:09 2013
@@ -1 +1 @@
-1467772
+1470318

Propchange: websites/staging/isis/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Apr 21 16:21:09 2013
@@ -1 +1 @@
-1467772
+1470318

Modified: websites/staging/isis/trunk/content/components/objectstores/jdo/about.html
==============================================================================
--- websites/staging/isis/trunk/content/components/objectstores/jdo/about.html (original)
+++ websites/staging/isis/trunk/content/components/objectstores/jdo/about.html Sun Apr 21 16:21:09 2013
@@ -3,7 +3,7 @@
   <head>
 
     <meta charset="utf-8">
-      <title>JDO (DataNucleus) Object Store
</title>
+      <title>DataNucleus (JDO) Object Store
</title>
     <meta name="description" content="">
     <meta name="author" content="">
 
@@ -112,7 +112,7 @@
       };
       function twshare () {
           window.open(
-                  "https://twitter.com/intent/tweet?url="+document.URL+"&text=JDO (DataNucleus) Object Store
",
+                  "https://twitter.com/intent/tweet?url="+document.URL+"&text=DataNucleus (JDO) Object Store
",
                   'Share on Twitter',
                   'width=800,height=526');
       };
@@ -232,12 +232,12 @@
 
 <div class="page-header">
 <p><a href="./../../../documentation.html">Docs</a>&nbsp;&raquo&nbsp;<a href="./../../../components/about.html">Components</a>&nbsp;&raquo&nbsp;<a href="./../../../components/objectstores/about.html">Objectstores</a>&nbsp;&raquo&nbsp;<a href="./../../../components/objectstores/jdo/about.html">Jdo</a></p>
-<h1>JDO (DataNucleus) Object Store
+<h1>DataNucleus (JDO) Object Store
 
 </h1>
 </div>
 
-<p>The JDO objectstore enables the persistence of domain objects using the JDO API. <a href="http://datanucleus.org">DataNucleues</a> - the reference implementation for JDO - is used as the backing implementation.</p>
+<p>The DataNucleus objectstore enables the persistence of domain objects using the JDO API.  <a href="http://datanucleus.org">DataNucleues</a> is the reference implementation for JDO.</p>
 
 <h3>Hints and tips:</h3>
 
@@ -245,6 +245,7 @@
 <li><a href="maven-and-eclipse.html">Maven and Eclipse</a></li>
 <li><a href="dates-blobs-lazy-loading.html">Dates, Blobs and Lazy Loading</a></li>
 <li><a href="using-jndi-datasource.html">Using a JNDI Datasource</a> [1.1.0-SNAPSHOT]</li>
+<li><a href="workarounds.html">Workarounds (the <code>IsisJdoSupport</code> service)</a> [1.1.0-SNAPSHOT]</li>
 <li><a href="enabling-logging.html">Enabling Logging</a></li>
 <li><a href="deploying-on-the-google-app-engine.html">Deploying on the Google App Engine</a></li>
 </ul>

Added: websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html
==============================================================================
--- websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html (added)
+++ websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html Sun Apr 21 16:21:09 2013
@@ -0,0 +1,412 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+
+    <meta charset="utf-8">
+      <title>Workarounds (the `IsisJdoSupport` service) [1.1.0-SNAPSHOT]</title>
+    <meta name="description" content="">
+    <meta name="author" content="">
+
+    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
+    <!--[if lt IE 9]>
+      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+
+    <!-- Le styles -->
+    <link href="./../../../bootstrap.css" rel="stylesheet">
+    <link href="./../../../prettify.css" rel="stylesheet">
+    <link href="./../../../bootstrap-mods.css" rel="stylesheet">
+
+    <style type="text/css">
+        body {
+          padding-top: 60px;
+        }
+        .sprite {
+            display: inline-block;
+            height: 20px;
+            margin: 0 auto 4px;
+            outline: medium none;
+            text-indent: -999em;
+            width: 24px;
+            background-image: url('./../../../images/sprites.png');
+            background-repeat: no-repeat;
+            overflow: hidden;
+            cursor: pointer;
+        }
+        .edit-page {
+            display: inline-block;
+            height: 20px;
+            margin: 0 auto 4px;
+            outline: medium none;
+            text-indent: -999em;
+            width: 24px;
+            background-image: url('./../../../images/edit.png');
+            background-repeat: no-repeat;
+            overflow: hidden;
+            cursor: pointer;
+        }
+        .fb-share {
+            background-position: 0px -40px;
+        }
+        .gp-share {
+            background-position: 0px 0px;
+        }
+        .tw-share {
+            background-position: 0px -80px;
+        }
+        .markdown-content {
+            min-height: 500px;
+        }
+        .book-image img {
+          border: 1px;
+          border-style: solid;
+        }
+        .release-matrix .heading {
+            background-color: #eeeeee;
+        }
+        .release-matrix .new {
+            color: #dd0000;
+            font-weight: bolder;
+        }
+        .stub,.note {
+            position: relative;
+            padding: 7px 15px;
+            margin-bottom: 18px;
+            color: #404040;
+            background-color: #eedc94;
+            background-repeat: repeat-x;
+            background-image: -khtml-gradient(linear, left top, left bottom, from(#fceec1), to(#eedc94));
+            background-image: -moz-linear-gradient(top, #fceec1, #eedc94);
+            background-image: -ms-linear-gradient(top, #fceec1, #eedc94);
+            background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fceec1), color-stop(100%, #eedc94));
+            background-image: -webkit-linear-gradient(top, #fceec1, #eedc94);
+            background-image: -o-linear-gradient(top, #fceec1, #eedc94);
+            background-image: linear-gradient(top, #fceec1, #eedc94);
+            filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fceec1', endColorstr='#eedc94', GradientType=0);
+            text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
+            border-color: #eedc94 #eedc94 #e4c652;
+            border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+            text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
+            border-width: 1px;
+            border-style: solid;
+            -webkit-border-radius: 4px;
+            -moz-border-radius: 4px;
+            border-radius: 4px;
+            -webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
+            -moz-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
+            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
+        }
+    </style>
+    <script type="text/javascript">
+      function fbshare () {
+          window.open(
+                  "http://www.facebook.com/sharer/sharer.php?u="+document.URL,
+                  'Share on Facebook',
+                  'width=640,height=426');
+      };
+      function gpshare () {
+          window.open(
+                  "https://plus.google.com/share?url="+document.URL,
+                  'Share on Google+',
+                  'width=584,height=385');
+      };
+      function twshare () {
+          window.open(
+                  "https://twitter.com/intent/tweet?url="+document.URL+"&text=Workarounds (the `IsisJdoSupport` service) [1.1.0-SNAPSHOT]",
+                  'Share on Twitter',
+                  'width=800,height=526');
+      };
+    </script>
+
+    <!-- Le fav and touch icons -->
+    <link rel="shortcut icon" href="./../../../images/favicon.ico">
+    <link rel="apple-touch-icon" href="./../../../images/apple-touch-icon.png">
+    <link rel="apple-touch-icon" sizes="72x72" href="./../../../images/apple-touch-icon-72x72.png">
+    <link rel="apple-touch-icon" sizes="114x114" href="./../../../images/apple-touch-icon-114x114.png">
+
+    <script src="./../../../javascript/prettify.js" type="text/javascript"></script>
+    <script src="./../../../javascript/jquery-latest.js"></script>
+
+
+    <script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
+    <script src="./../../../javascript/common.js"></script>
+    <script src="./../../../javascript/prettyprint.js"></script>
+
+    <script src="./../../../javascript/bootstrap-alert.js"></script>
+    <script src="./../../../javascript/bootstrap-dropdown.js"></script>
+    <script src="./../../../javascript/bootstrap-tooltip.js"></script>
+    <script src="./../../../javascript/bootstrap-alerts.js"></script>
+    <script src="./../../../javascript/bootstrap-modal.js"></script>
+    <script src="./../../../javascript/bootstrap-transition.js"></script>
+    <script src="./../../../javascript/bootstrap-button.js"></script>
+    <script src="./../../../javascript/bootstrap-popover.js"></script>
+    <script src="./../../../javascript/bootstrap-twipsy.js"></script>
+    <script src="./../../../javascript/bootstrap-buttons.js"></script>
+    <script src="./../../../javascript/bootstrap-scrollspy.js"></script>
+    <script src="./../../../javascript/bootstrap-typeahead.js"></script>
+    <script src="./../../../javascript/bootstrap-carousel.js"></script>
+    <script src="./../../../javascript/bootstrap-tab.js"></script>
+    <script src="./../../../javascript/bootstrap-collapse.js"></script>
+    <script src="./../../../javascript/bootstrap-tabs.js"></script>
+
+    
+    
+    
+
+    <script>
+    $(function () { prettyPrint() })
+    $().dropdown()
+    </script>
+
+    <!-- GAQ stuff removed here -->
+
+
+  </head>
+
+  <body>
+
+    <div class="topbar">
+      <div class="fill">
+        <div class="container">
+          <a class="brand" href="./../../../index.html">Apache Isis&trade;</a>
+          <ul class="nav">
+            <li><a href="./../../../index.html">Home</a></li>
+            <li><a href="./../../../download.html">Download</a></li>
+            <li class="dropdown">
+              <a href="#" class="dropdown-toggle" data-toggle="dropdown">Screenshots<b class="caret"></b></a>
+              <ul class="dropdown-menu">
+                <li><a href="./../../../getting-started/screenshots.html">Screenshots</a></li>
+                <li><a href="./../../../getting-started/screencasts.html">Screencasts</a></li>
+                <!--
+                <li><a href="#">Online Demo</a></li>
+                -->
+              </ul>
+            </li>
+            <li><a href="./../../../documentation.html">Docs</a></li>
+            <li><a href="./../../../support.html">Support</a></li>
+            <li class="dropdown">
+              <a href="#" class="dropdown-toggle" data-toggle="dropdown">Apache <b class="caret"></b></a>
+              <ul class="dropdown-menu">
+                <li>
+                  <a href="http://www.apache.org/">Apache Homepage <i class="icon-share-alt"></i></a>
+                </li>
+                <li>
+                  <a href="http://www.apache.org/licenses/">Licenses <i class="icon-share-alt"></i></a>
+                </li>
+                <li>
+                  <a href="http://www.apache.org/security/">Security <i class="icon-share-alt"></i></a>
+                </li>
+                <li>
+                  <a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship <i class="icon-share-alt"></i></a>
+                </li>
+                <li>
+                  <a href="http://www.apache.org/foundation/thanks.html">Thanks <i class="icon-share-alt"></i></a>
+                </li>
+              </ul>
+            </li>
+
+          </ul>
+
+            <!-- Google CSE Search Box Begins -->
+            <div style="float: right; position: relative; ">
+          <form action="http://www.google.com/cse" id="cse-search-box" _lpchecked="1">
+            <div>
+                <input type="hidden" name="cx" value="001500763902520246267:purt3m54z98">
+                <input type="hidden" name="ie" value="UTF-8">
+                <input type="text" name="q" size="31" style="border: 1px solid rgb(126, 157, 185); padding: 2px; background-color: rgb(255, 255, 255); background-position: 0% 50%; background-repeat: no-repeat no-repeat;">
+                <input type="submit" name="sa" value="Search">
+            </div>
+            <input name="siteurl" type="hidden" value="incubator.apache.org/isis/">
+            <input name="ref" type="hidden" value="">
+            <input name="ss" type="hidden" value="677j458329j2">
+        </form>
+        </div>
+            <!-- Google CSE Search Box Ends -->
+        </div>
+      </div>
+    </div>
+
+    <div class="container">
+      <div class="markdown-content">
+      
+
+<div class="page-header">
+<p><a href="./../../../documentation.html">Docs</a>&nbsp;&raquo&nbsp;<a href="./../../../components/about.html">Components</a>&nbsp;&raquo&nbsp;<a href="./../../../components/objectstores/about.html">Objectstores</a>&nbsp;&raquo&nbsp;<a href="./../../../components/objectstores/jdo/about.html">Jdo</a></p>
+<h1>Workarounds (the `IsisJdoSupport` service) [1.1.0-SNAPSHOT]
+
+</h1>
+</div>
+
+<p>There are a number of limitations in DataNucleus' implementation of JDO, specifically with regard to 1:m bidirectional relationships.  </p>
+
+<ul>
+<li>loading the children from the parent does not fire the <code>jdoPostLoad</code> callback (either on the entity via <code>javax.jdo.listener.LoadCallback</code> nor <code>javax.jdo.listener.LoadLifecycleListener</code>)</li>
+<li>persisting a child entity does not cause the parent's collection to be updated.</p>
+
+<p>Note that this is documented behaviour; see this <a href="http://www.datanucleus.org/products/datanucleus/jdo/orm/relationships.html">DataNucleus page</a>.</li>
+</ul>
+
+<p>The <code>IsisJdoSupport</code> service provides a number of methods to enable workarounds for these cases.</p>
+
+<p><em>This page will be updated if we determine that such workarounds are not (or are no longer) required.</em></p>
+
+<h2><code>IsisJdoSupport</code></h2>
+
+<p>The <code>IsisJdoSupport</code> is defined in the JDO applib. It is defined as:</p>
+
+<pre><code>package org.apache.isis.objectstore.jdo.applib.service.support;
+</code></pre>
+
+<p>public interface IsisJdoSupport {
+        <T> T injected(T domainObject);
+        <T> T refresh(T domainObject);
+    }</p>
+
+<p>The implementation is <code>IsisJdoSupportImpl</code>.  It is registered in <code>isis.properties</code> as per usual:</p>
+
+<pre><code>isis.services = ...\
+            org.apache.isis.objectstore.jdo.datanucleus.service.support.IsisJdoSupportImpl,\
+                ...
+</code></pre>
+
+<p>In the domain entity or service, add:</p>
+
+<pre><code>// {{
+private IsisJdoSupport isisJdoSupport;
+public void setIsisJdoSupport(IsisJdoSupport isisJdoSupport) {
+    this.isisJdoSupport = isisJdoSupport;
+}
+// }}
+</code></pre>
+
+<p>The service will then be automatically injected as normal.</p>
+
+<h2>Workaround for Lazy Loading</h2>
+
+<p>In a bidir 1:m, we have found that the post-load callback for the children is not fired.</p>
+
+<p>The consequence of this is that any domain services used by the child object (including <code>DomainObjectContainer</code>) are not injected into the child.</p>
+
+<p>The workaround is to have the parent inject the services when returning the children.</p>
+
+<p>For example, suppose we have a Customer &lt;->* Order bidir relationship.  In Customer, we would have:</p>
+
+<pre><code>// {{ Orders (Collection)
+private SortedSet&lt;Order&gt; orders = new TreeSet&lt;Order&gt;();
+
+@Persistent(mappedBy = "customer")
+public SortedSet&lt;Order&gt; getOrders() {
+
+    if (this.orders == null) {
+        // this can happen, it would seem, by JDO/DN when it is 
+        // setting up the object with its own set impl for lazy loading.
+        return null;
+    } else {
+        // inject each element before returning it
+        return Sets.newTreeSet(
+            Iterables.transform(
+                this.orders, 
+                new Function&lt;Order, Order&gt;(){
+                    public Order apply(Order order) {
+                        return isisJdoSupport.injected(order);                        
+                    }
+                }));
+    }
+}
+
+public void setOrders(final SortedSet&lt;Order&gt; orders) {
+    this.orders = orders;
+}
+</code></pre>
+
+<p>Alternatively, you can reload each child object.  Change:</p>
+
+<pre><code>                new Function&lt;Order, Order&gt;(){
+                    public Order apply(Order order) {
+                        return isisJdoSupport.injected(order);                        
+                    }
+                }));
+</code></pre>
+
+<p>to:</p>
+
+<pre><code>                new Function&lt;Order, Order&gt;(){
+                    public Order apply(Order order) {
+                        return isisJdoSupport.refresh(order);
+                    }
+                }));
+</code></pre>
+
+<p>Use <a href="enabling-logging.html">logging</a> to determine if this makes more calls to the database than using the <code>injected()</code> method.</p>
+
+<h2>Handling Unmanaged Parent Relationship</h2>
+
+<p>(Also in a bidir 1:m), we have found that the parent collection is not added to if a new child entity is persisted.</p>
+
+<p>There are two choices here.  The first is to ensure that there is code that manually updates each side of the relationship.  The second is to flush the changes and then to manually reload the parent entity from the database.</p>
+
+<p>For example, suppose we have a Customer &lt;->* Order bidir relationship, with an action that persists an Order.  </p>
+
+<p>To update both sides of the relationship, use:</p>
+
+<pre><code>public Order newOrder(final Customer customer) {
+    Order order = newTransientInstance(Order.class);
+    order.setCustomer(customer);
+    customer.getOrders().add(order); // update parent's collection
+    persist(customer);
+    return order;
+}
+</code></pre>
+
+<p>Alternatively, to reload the parent, use the <code>IsisJdoSupport</code> service:</p>
+
+<pre><code>public Order newOrder(final Customer customer) {
+    Order order = newTransientInstance(Order.class);
+    order.setCustomer(customer);
+    persist(customer);
+    getContainer().flush(); // to database
+    isisJdoSupport.refresh(customer); // reload parent from database
+    return order;
+}
+</code></pre>
+
+
+
+      </div>
+
+        <div id="edit" class="modal hide fade in" style="display: none; ">
+            <div class="modal-header">
+                <a class="close" data-dismiss="modal">x</a>
+
+                <h3>Thank you for contributing to the documention!</h3>
+            </div>
+            <div class="modal-body">
+                <h4>Any help with the documentation is greatly appreciated.</h4>
+                <p>All edits are reviewed before going live, so feel free to do much more than fix typos or links.  If you see a page that could benefit from an entire rewrite, we'd be thrilled to review it.  Don't be surprised if we like it so much we ask you for help with other pages :)</p>
+                <small>NOTICE: unless indicated otherwise on the pages in question, all editable content available from apache.org is presumed to be licensed under the Apache License (AL) version 2.0 and hence all submissions to apache.org treated as formal Contributions under the license terms.</small>
+                <!--[if gt IE 6]>
+                <h4>Internet Explorer Users</h4>
+                <p>If you are not an Apache committer, click the Yes link and enter a <i>anonymous</i> for the username and leave the password empty</p>
+                <![endif]-->
+
+            </div>
+            <div class="modal-footer">
+                Do you have an Apache ID?
+                <a href="javascript:void(location.href='https://cms.apache.org/redirect?uri='+escape(location.href))" class="btn">Yes</a>
+                <a href="javascript:void(location.href='https://anonymous:@cms.apache.org/redirect?uri='+escape(location.href))" class="btn">No</a>
+            </div>
+        </div>
+        <script src="./../../../javascript/bootstrap-modal.js"></script>
+
+      <footer>
+        <p>
+        Copyright &copy; 2012~2013 The Apache Software Foundation, Licensed under the Apache License, Version 2.0.
+        <br/>
+        Apache Isis, Isis, Apache, the Apache feather logo, and the Apache Isis project logo are trademarks of The Apache Software Foundation.
+        </p>
+      </footer>
+
+    </div> <!-- /container -->
+
+  </body>
+</html>

Modified: websites/staging/isis/trunk/content/documentation.html
==============================================================================
--- websites/staging/isis/trunk/content/documentation.html (original)
+++ websites/staging/isis/trunk/content/documentation.html Sun Apr 21 16:21:09 2013
@@ -434,13 +434,14 @@
 <p><div class="row-even">
 <div class="span-one-third"></p>
 
-<h3>JDO <a href="components/objectstores/jdo/release-notes/about.html">1.0.0</a></h3>
+<h3>DataNucleus (JDO) <a href="components/objectstores/jdo/release-notes/about.html">1.0.0</a></h3>
 
 <ul>
 <li><a href="components/objectstores/jdo/about.html">About</a></li>
 <li><a href="components/objectstores/jdo/maven-and-eclipse.html">Maven and Eclipse</a></li>
 <li><a href="components/objectstores/jdo/dates-blobs-lazy-loading.html">Dates, Blobs and Lazy Loading</a></li>
 <li><a href="components/objectstores/jdo/using-jndi-datasource.html">Using a JNDI Datasource</a> [1.1.0-SNAPSHOT]</li>
+<li><a href="components/objectstores/jdo/workarounds.html">Workarounds</a> [1.1.0-SNAPSHOT]</li>
 <li><a href="components/objectstores/jdo/enabling-logging.html">Enabling Logging</a></li>
 <li><a href="components/objectstores/jdo/deploying-on-the-google-app-engine.html">Deploying on the Google App Engine</a></li>
 </ul>