Author: buildbot
Date: Fri Apr 26 06:24:18 2013
New Revision: 859958
Log:
Staging update by buildbot for isis
Modified:
websites/staging/isis/trunk/cgi-bin/ (props changed)
websites/staging/isis/trunk/content/ (props changed)
websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html
Propchange: websites/staging/isis/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Apr 26 06:24:18 2013
@@ -1 +1 @@
-1470318
+1476062
Propchange: websites/staging/isis/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Apr 26 06:24:18 2013
@@ -1 +1 @@
-1470318
+1476062
Modified:
websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html
==============================================================================
---
websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html
(original)
+++
websites/staging/isis/trunk/content/components/objectstores/jdo/workarounds.html
Fri Apr 26 06:24:18 2013
@@ -240,7 +240,9 @@
<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>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>)</p>
+
+<p>More precisely, this doesn't occur if the child being loaded has
subclasses, and the subclasses has fields/properties that are part of the
default fetch group.</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>
@@ -283,19 +285,29 @@ public void setIsisJdoSupport(IsisJdoSup
<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>In a bidir 1:m, we have found that in certain circumstances the post-load
callback for the children is not fired. Specifically, if the child has
subclasses, and the subclass has fields/properties that are in the <a
href="http://db.apache.org/jdo/fetchgroups.html">default fetch group</a>.</p>
+
+<p>A test case illustrating the problem (<em>though whether with the spec or
the DN implementation, we are not yet sure</em>) can be found <a
href="https://github.com/danhaywood/test-jdo">here on github</a>.</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 <->* Order bidir relationship.
In Customer, we would have:</p>
+<p>For example, suppose we have a <code>Customer</code> <->*
<code>Order</code> bidir relationship, and where <code>Order</code> my have
subclasses, eg <code>RushedOrder</code>. In <code>Customer</code>, we would
add a new method <code>getOrdersWorkaround()</code>:</p>
<pre><code>// {{ Orders (Collection)
private SortedSet<Order> orders = new TreeSet<Order>();
@Persistent(mappedBy = "customer")
public SortedSet<Order> getOrders() {
+ return this.orders;
+}
+
+public void setOrders(final SortedSet<Order> orders) {
+ this.orders = orders;
+}
+
+public SortedSet<Order> getOrdersWorkaround() {
if (this.orders == null) {
// this can happen, it would seem, by JDO/DN when it is
@@ -305,7 +317,7 @@ public SortedSet<Order> getOrders(
// inject each element before returning it
return Sets.newTreeSet(
Iterables.transform(
- this.orders,
+ this.getOrders(),
new Function<Order, Order>(){
public Order apply(Order order) {
return isisJdoSupport.injected(order);
@@ -313,10 +325,6 @@ public SortedSet<Order> getOrders(
}));
}
}
-
-public void setOrders(final SortedSet<Order> orders) {
- this.orders = orders;
-}
</code></pre>
<p>Alternatively, you can reload each child object. Change:</p>