You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/12/06 18:42:16 UTC

[6/52] [partial] ISIS-188: moving framework/ subdirs up to parent

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
new file mode 100644
index 0000000..1cb51b0f
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_lazyLoading.java
@@ -0,0 +1,85 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.adaptermanager;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Persistence_lazyLoading {
+
+    private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
+    private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
+        .withServices(referencingRepo, referencedRepo)
+        .build();
+
+    @Test
+    public void lazyLoading_and_adapters() throws Exception {
+        iswf.beginTran();
+        referencedRepo.newEntity().setName("Referenced 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        UnidirReferencedEntity referencedEntity1 = referencedRepo.list().get(0);
+        
+        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
+        referencingEntity1.setName("Referencing 1");
+        referencingEntity1.setReferenced(referencedEntity1);
+        
+        iswf.commitTran();
+        
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<UnidirReferencingEntity> list = referencingRepo.list();
+        referencingEntity1 = list.get(0);
+        
+        assertThat(referencingEntity1.referenced, is(nullValue())); // lazy loading
+        UnidirReferencedEntity referenced = referencingEntity1.getReferenced();
+        ObjectAdapter referencedAdapter = iswf.adapterFor(referenced);
+        assertThat(referencedAdapter.getResolveState(), is(ResolveState.RESOLVED));
+        assertThat(referenced, is(not(nullValue())));
+        
+        iswf.commitTran();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
new file mode 100644
index 0000000..a0c9db0
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_loadObject.java
@@ -0,0 +1,101 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.adaptermanager;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Persistence_loadObject {
+
+    private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
+    private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
+        .withServices(referencingRepo, referencedRepo)
+        .build();
+
+
+    @Test
+    public void persist_then_update_using_persistentAdapterFor() throws Exception {
+        
+        iswf.beginTran();
+        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
+        referencedEntity1.setName("Referenced 1");
+        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
+        referencedEntity2.setName("Referenced 2");
+
+        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
+        referencingEntity1.setName("Referencing 1");
+        referencingEntity1.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
+        referencingEntity2.setName("Referencing 2");
+        referencingEntity2.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
+        referencingEntity3.setName("Referencing 3");
+        referencingEntity3.setReferenced(referencedEntity2);
+
+        iswf.commitTran();
+
+        TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();
+
+        TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
+        TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();
+
+
+        // when ...
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+
+        ObjectAdapter referencingAdapter2 = iswf.getPersistor().loadObject(referencingOid2);
+        referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
+        
+		UnidirReferencedEntity referenced = referencingEntity2.getReferenced();
+		
+		ObjectAdapter referencedAdapter1 = iswf.getAdapterManager().adapterFor(referencedOid1);
+		assertThat(referenced, is(referencedAdapter1.getObject()));
+
+        // ...switch to refer to other
+
+		ObjectAdapter referencedAdapter2 = iswf.getAdapterManager().adapterFor(referencedOid2);
+		referencedEntity2 = (UnidirReferencedEntity) referencedAdapter2.getObject();
+
+		referencingEntity2.setReferenced(referencedEntity2);
+        iswf.commitTran();
+
+    }
+
+
+
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
new file mode 100644
index 0000000..1f37a0b
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/adaptermanager/Persistence_persistentAdapterFor.java
@@ -0,0 +1,114 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.adaptermanager;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Persistence_persistentAdapterFor {
+
+    private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
+    private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
+        .withServices(referencingRepo, referencedRepo)
+        .build();
+
+
+    @Test
+    public void persist_then_update_using_persistentAdapterFor() throws Exception {
+        
+        iswf.beginTran();
+        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
+        referencedEntity1.setName("Referenced 1");
+        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
+        referencedEntity2.setName("Referenced 2");
+
+        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
+        referencingEntity1.setName("Referencing 1");
+        referencingEntity1.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
+        referencingEntity2.setName("Referencing 2");
+        referencingEntity2.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
+        referencingEntity3.setName("Referencing 3");
+        referencingEntity3.setReferenced(referencedEntity2);
+
+        iswf.commitTran();
+
+        TypedOid referencingOid2 = (TypedOid) iswf.adapterFor(referencingEntity2).getOid();
+
+        TypedOid referencedOid1 = (TypedOid) iswf.adapterFor(referencedEntity1).getOid();
+        TypedOid referencedOid2 = (TypedOid) iswf.adapterFor(referencedEntity2).getOid();
+
+
+        // when ...
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+
+        ObjectAdapter referencingAdapter2 = iswf.getAdapterManager().adapterFor(referencingOid2);
+        referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
+        
+		UnidirReferencedEntity referenced = referencingEntity2.getReferenced();
+		
+		ObjectAdapter referencedAdapter1 = iswf.getAdapterManager().adapterFor(referencedOid1);
+		assertThat(referenced, is(referencedAdapter1.getObject()));
+
+        // ...switch to refer to other
+
+		ObjectAdapter referencedAdapter2 = iswf.getAdapterManager().adapterFor(referencedOid2);
+		referencedEntity2 = (UnidirReferencedEntity) referencedAdapter2.getObject();
+
+		referencingEntity2.setReferenced(referencedEntity2);
+        iswf.commitTran();
+
+        // then...
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+
+        referencingAdapter2 = iswf.getAdapterManager().adapterFor(referencingOid2);
+        referencingEntity2 = (UnidirReferencingEntity) referencingAdapter2.getObject();
+        
+		referenced = referencingEntity2.getReferenced();
+		
+		referencedAdapter2 = iswf.getAdapterManager().adapterFor(referencedOid2);
+		
+        // ...is switched
+		assertThat(referenced, is(referencedAdapter2.getObject()));
+		
+        iswf.commitTran();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
new file mode 100644
index 0000000..da36c89
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithListParent.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.BidirWithListChildEntity;
+import org.apache.isis.tck.dom.refs.BidirWithListParentEntity;
+import org.apache.isis.tck.dom.refs.BidirWithListParentEntityRepository;
+
+public class Persistence_persist_bidirWithListParent {
+
+    private BidirWithListParentEntityRepository repo = new BidirWithListParentEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("BIDIRWITHLISTCHILDeNTITY"))
+        .with(Utils.listenerToDeleteFrom("BIDIRWITHLISTPARENTENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwoParents() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<BidirWithListParentEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistTwoChildrenOfParent() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        BidirWithListParentEntity retrievedEntity = repo.list().get(0);
+        retrievedEntity.newChild("Child 1 of Parent 1");
+        retrievedEntity.newChild("Child 2 of Parent 1");
+        retrievedEntity.newChild("Child 3 of Parent 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        retrievedEntity = repo.list().get(0);
+        List<BidirWithListChildEntity> children = retrievedEntity.getChildren();
+        assertThat(children.size(), is(3));
+        iswf.commitTran();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
new file mode 100644
index 0000000..c26237b
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_bidirWithSetParent.java
@@ -0,0 +1,130 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.BidirWithSetChildEntity;
+import org.apache.isis.tck.dom.refs.BidirWithSetParentEntity;
+import org.apache.isis.tck.dom.refs.BidirWithSetParentEntityRepository;
+import org.apache.isis.tck.dom.refs.ParentEntity;
+import org.apache.isis.tck.dom.refs.ParentEntityRepository;
+
+public class Persistence_persist_bidirWithSetParent {
+
+    private BidirWithSetParentEntityRepository repo = new BidirWithSetParentEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("BIDIRWITHSETCHILDENTITY"))
+        .with(Utils.listenerToDeleteFrom("BIDIRWITHSETPARENTENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwoParents() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<BidirWithSetParentEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistTwoChildrenOfParent() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        BidirWithSetParentEntity retrievedEntity = repo.list().get(0);
+        retrievedEntity.newChild("Child 1 of Parent 1");
+        retrievedEntity.newChild("Child 2 of Parent 1");
+        retrievedEntity.newChild("Child 3 of Parent 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        retrievedEntity = repo.list().get(0);
+        Set<BidirWithSetChildEntity> children = retrievedEntity.getChildren();
+        assertThat(children.size(), is(3));
+        iswf.commitTran();
+    }
+
+    @Ignore("Not currently working, is an update")
+    @Test
+    public void updateBidirectional() throws Exception {
+        iswf.beginTran();
+        BidirWithSetParentEntity parent1 = repo.newEntity();
+        parent1.setName("Parent 1");
+        BidirWithSetParentEntity parent2 = repo.newEntity();
+        parent2.setName("Parent 2");
+
+        parent1.newChild("Child 1 of Parent 1");
+        parent1.newChild("Child 2 of Parent 1");
+        parent1.newChild("Child 3 of Parent 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        parent1 = repo.list().get(0);
+        parent2 = repo.list().get(0);
+        Set<BidirWithSetChildEntity> children = parent1.getChildren();
+        assertThat(children.size(), is(3));
+        BidirWithSetChildEntity child1 = parent1.getChildren().iterator().next();
+        child1.moveTo(parent2);
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        parent1 = repo.list().get(0);
+        parent2 = repo.list().get(0);
+        children = parent1.getChildren();
+        assertThat(children.size(), is(2));
+        
+        children = parent2.getChildren();
+        assertThat(children.size(), is(1));
+        iswf.commitTran();
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
new file mode 100644
index 0000000..2a93457
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyclass.java
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.PolyClassChildEntity;
+import org.apache.isis.tck.dom.refs.PolyClassParentEntity;
+import org.apache.isis.tck.dom.refs.PolyClassParentEntityRepository;
+
+public class Persistence_persist_polyclass {
+
+    private PolyClassParentEntityRepository repo = new PolyClassParentEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("POLYCLASSSUBTYPE1ENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYCLASSCHILDENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYCLASSPARENTENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwoParents() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<PolyClassParentEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistSixDifferentChildrenOfParent() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        PolyClassParentEntity retrievedEntity = repo.list().get(0);
+        retrievedEntity.newSubtype1("Child 1 of Parent 1", 123);
+        retrievedEntity.newSubtype1("Child 2 of Parent 1", 456);
+        retrievedEntity.newSubtype2("Child 3 of Parent 1", "abc");
+        retrievedEntity.newSubtype2("Child 4 of Parent 1", "def");
+        retrievedEntity.newSubtype3("Child 5 of Parent 1", BigDecimal.ONE);
+        retrievedEntity.newSubtype3("Child 6 of Parent 1", BigDecimal.TEN);
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        retrievedEntity = repo.list().get(0);
+        Set<PolyClassChildEntity> children = retrievedEntity.getChildren();
+        assertThat(children.size(), is(6));
+        iswf.commitTran();
+    }
+
+    
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
new file mode 100644
index 0000000..e230959
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinter.java
@@ -0,0 +1,98 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.PolyClassChildEntity;
+import org.apache.isis.tck.dom.refs.PolyClassParentEntity;
+import org.apache.isis.tck.dom.refs.PolyClassParentEntityRepository;
+import org.apache.isis.tck.dom.refs.PolyInterface;
+import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntity;
+import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntityRepository;
+
+public class Persistence_persist_polyinter {
+
+    private PolyInterfaceParentEntityRepository repo = new PolyInterfaceParentEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACEPARENTENTITY_CHILDREN"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACESUBTYPE1ENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACESUBTYPE2ENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACESUBTYPE3ENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACEPARENTENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwoParents() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<PolyInterfaceParentEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistSixDifferentChildrenOfParent() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        PolyInterfaceParentEntity retrievedEntity = repo.list().get(0);
+        retrievedEntity.newSubtype1("Child 1 of Parent 1", 123);
+        retrievedEntity.newSubtype1("Child 2 of Parent 1", 456);
+        retrievedEntity.newSubtype2("Child 3 of Parent 1", "abc");
+        retrievedEntity.newSubtype2("Child 4 of Parent 1", "def");
+        retrievedEntity.newSubtype3("Child 5 of Parent 1", BigDecimal.ONE);
+        retrievedEntity.newSubtype3("Child 6 of Parent 1", BigDecimal.TEN);
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        retrievedEntity = repo.list().get(0);
+        Set<PolyInterface> children = retrievedEntity.getChildren();
+        assertThat(children.size(), is(6));
+        iswf.commitTran();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
new file mode 100644
index 0000000..a1f5faa
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_polyinterIdentityStrategy.java
@@ -0,0 +1,100 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.PolyClassChildEntity;
+import org.apache.isis.tck.dom.refs.PolyClassParentEntity;
+import org.apache.isis.tck.dom.refs.PolyClassParentEntityRepository;
+import org.apache.isis.tck.dom.refs.PolyInterface;
+import org.apache.isis.tck.dom.refs.PolyInterfaceIdentityStrategy;
+import org.apache.isis.tck.dom.refs.PolyInterfaceIdentityStrategyParentEntity;
+import org.apache.isis.tck.dom.refs.PolyInterfaceIdentityStrategyParentEntityRepository;
+import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntity;
+import org.apache.isis.tck.dom.refs.PolyInterfaceParentEntityRepository;
+
+public class Persistence_persist_polyinterIdentityStrategy {
+
+    private PolyInterfaceIdentityStrategyParentEntityRepository repo = new PolyInterfaceIdentityStrategyParentEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYPARENTENTITY_CHILDREN"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYSUBTYPE1ENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYSUBTYPE2ENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYSUBTYPE3ENTITY"))
+        .with(Utils.listenerToDeleteFrom("POLYINTERFACEIDENTITYSTRATEGYPARENTENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwoParents() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<PolyInterfaceIdentityStrategyParentEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistSixDifferentChildrenOfParent() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        PolyInterfaceIdentityStrategyParentEntity retrievedEntity = repo.list().get(0);
+        retrievedEntity.newSubtype1("Child 1 of Parent 1", 123);
+        retrievedEntity.newSubtype1("Child 2 of Parent 1", 456);
+        retrievedEntity.newSubtype2("Child 3 of Parent 1", "abc");
+        retrievedEntity.newSubtype2("Child 4 of Parent 1", "def");
+        retrievedEntity.newSubtype3("Child 5 of Parent 1", BigDecimal.ONE);
+        retrievedEntity.newSubtype3("Child 6 of Parent 1", BigDecimal.TEN);
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        retrievedEntity = repo.list().get(0);
+        Set<PolyInterfaceIdentityStrategy> children = retrievedEntity.getChildren();
+        assertThat(children.size(), is(6));
+        iswf.commitTran();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
new file mode 100644
index 0000000..dbe851f
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_referencing.java
@@ -0,0 +1,136 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Persistence_persist_referencing {
+
+    private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
+    private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
+        .withServices(referencingRepo, referencedRepo)
+        .build();
+
+    @Test
+    public void persist() throws Exception {
+        
+        iswf.beginTran();
+        referencedRepo.newEntity().setName("Referenced 1");
+        referencedRepo.newEntity().setName("Referenced 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        UnidirReferencedEntity referencedEntity1 = referencedRepo.list().get(0);
+        UnidirReferencedEntity referencedEntity2 = referencedRepo.list().get(1);
+        
+        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
+        referencingEntity1.setName("Referencing 1");
+        referencingEntity1.setReferenced(referencedEntity1);
+        
+        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
+        referencingEntity2.setName("Referencing 2");
+        referencingEntity2.setReferenced(referencedEntity1);
+
+        UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
+        referencingEntity3.setName("Referencing 3");
+        referencingEntity3.setReferenced(referencedEntity2);
+
+        iswf.commitTran();
+        
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<UnidirReferencingEntity> list = referencingRepo.list();
+        referencingEntity1 = list.get(0);
+        referencingEntity2 = list.get(1);
+        referencingEntity3 = list.get(2);
+        
+        assertThat(referencingEntity1.getReferenced(), is(not(nullValue())));
+        assertThat(referencingEntity2.getReferenced(), is(not(nullValue())));
+        assertThat(referencingEntity3.getReferenced(), is(not(nullValue())));
+        
+        assertThat(referencingEntity1.getReferenced(), is(referencingEntity1.getReferenced()));
+        assertThat(referencingEntity1.getReferenced(), is(not(referencingEntity3.getReferenced())));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistAGraphOfObjects() throws Exception {
+        
+        iswf.beginTran();
+        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
+        referencedEntity1.setName("Referenced 1");
+        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
+        referencedEntity2.setName("Referenced 2");
+
+        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
+        referencingEntity1.setName("Referencing 1");
+        referencingEntity1.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
+        referencingEntity2.setName("Referencing 2");
+        referencingEntity2.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
+        referencingEntity3.setName("Referencing 3");
+        referencingEntity3.setReferenced(referencedEntity2);
+        iswf.commitTran();
+        
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<UnidirReferencingEntity> list = referencingRepo.list();
+        referencingEntity1 = list.get(0);
+        referencingEntity2 = list.get(1);
+        referencingEntity3 = list.get(2);
+        
+        assertThat(referencingEntity1.getReferenced(), is(not(nullValue())));
+        assertThat(referencingEntity2.getReferenced(), is(not(nullValue())));
+        assertThat(referencingEntity3.getReferenced(), is(not(nullValue())));
+        
+        assertThat(referencingEntity1.getReferenced(), is(referencingEntity1.getReferenced()));
+        assertThat(referencingEntity1.getReferenced(), is(not(referencingEntity3.getReferenced())));
+        iswf.commitTran();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
new file mode 100644
index 0000000..87f7fd0
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidir.java
@@ -0,0 +1,134 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.BidirWithSetChildEntity;
+import org.apache.isis.tck.dom.refs.BidirWithSetParentEntity;
+import org.apache.isis.tck.dom.refs.BidirWithSetParentEntityRepository;
+import org.apache.isis.tck.dom.refs.ParentEntity;
+import org.apache.isis.tck.dom.refs.ParentEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirFkChildEntity;
+import org.apache.isis.tck.dom.refs.UnidirFkParentEntity;
+import org.apache.isis.tck.dom.refs.UnidirFkParentEntityRepository;
+
+public class Persistence_persist_unidir {
+
+    private UnidirFkParentEntityRepository repo = new UnidirFkParentEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("UNIDIRFKCHILDENTITY"))
+        .with(Utils.listenerToDeleteFrom("UNIDIRFKPARENTENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwoParents() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<UnidirFkParentEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistTwoChildrenOfParent() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        UnidirFkParentEntity retrievedEntity = repo.list().get(0);
+        retrievedEntity.newChild("Child 1 of Parent 1");
+        retrievedEntity.newChild("Child 2 of Parent 1");
+        retrievedEntity.newChild("Child 3 of Parent 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        retrievedEntity = repo.list().get(0);
+        Set<UnidirFkChildEntity> children = retrievedEntity.getChildren();
+        assertThat(children.size(), is(3));
+        iswf.commitTran();
+    }
+
+    @Ignore("Not currently working, is an update")
+    @Test
+    public void updateBidirectional() throws Exception {
+        iswf.beginTran();
+        UnidirFkParentEntity parent1 = repo.newEntity();
+        parent1.setName("Parent 1");
+        UnidirFkParentEntity parent2 = repo.newEntity();
+        parent2.setName("Parent 2");
+
+        parent1.newChild("Child 1 of Parent 1");
+        parent1.newChild("Child 2 of Parent 1");
+        parent1.newChild("Child 3 of Parent 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        parent1 = repo.list().get(0);
+        parent2 = repo.list().get(0);
+        Set<UnidirFkChildEntity> children = parent1.getChildren();
+        assertThat(children.size(), is(3));
+        UnidirFkChildEntity child1 = parent1.getChildren().iterator().next();
+        parent1.removeChild(child1);
+        parent2.addChild(child1);
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        parent1 = repo.list().get(0);
+        parent2 = repo.list().get(0);
+        children = parent1.getChildren();
+        assertThat(children.size(), is(2));
+        
+        children = parent2.getChildren();
+        assertThat(children.size(), is(1));
+        iswf.commitTran();
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
new file mode 100644
index 0000000..d94a2d0
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_persist_unidirJoin.java
@@ -0,0 +1,137 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.BidirWithSetChildEntity;
+import org.apache.isis.tck.dom.refs.BidirWithSetParentEntity;
+import org.apache.isis.tck.dom.refs.BidirWithSetParentEntityRepository;
+import org.apache.isis.tck.dom.refs.ParentEntity;
+import org.apache.isis.tck.dom.refs.ParentEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirFkChildEntity;
+import org.apache.isis.tck.dom.refs.UnidirFkParentEntity;
+import org.apache.isis.tck.dom.refs.UnidirFkParentEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirJoinChildEntity;
+import org.apache.isis.tck.dom.refs.UnidirJoinParentEntity;
+import org.apache.isis.tck.dom.refs.UnidirJoinParentEntityRepository;
+
+public class Persistence_persist_unidirJoin {
+
+    private UnidirJoinParentEntityRepository repo = new UnidirJoinParentEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("UNIDIRJOINCHILDENTITY"))
+        .with(Utils.listenerToDeleteFrom("UNIDIRJOINPARENTENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwoParents() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<UnidirJoinParentEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persistTwoChildrenOfParent() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setName("Parent 1");
+        repo.newEntity().setName("Parent 2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        UnidirJoinParentEntity retrievedEntity = repo.list().get(0);
+        retrievedEntity.newChild("Child 1 of Parent 1");
+        retrievedEntity.newChild("Child 2 of Parent 1");
+        retrievedEntity.newChild("Child 3 of Parent 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        retrievedEntity = repo.list().get(0);
+        Set<UnidirJoinChildEntity> children = retrievedEntity.getChildren();
+        assertThat(children.size(), is(3));
+        iswf.commitTran();
+    }
+
+    @Ignore("Not currently working, is an update")
+    @Test
+    public void updateBidirectional() throws Exception {
+        iswf.beginTran();
+        UnidirJoinParentEntity parent1 = repo.newEntity();
+        parent1.setName("Parent 1");
+        UnidirJoinParentEntity parent2 = repo.newEntity();
+        parent2.setName("Parent 2");
+
+        parent1.newChild("Child 1 of Parent 1");
+        parent1.newChild("Child 2 of Parent 1");
+        parent1.newChild("Child 3 of Parent 1");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        parent1 = repo.list().get(0);
+        parent2 = repo.list().get(0);
+        Set<UnidirJoinChildEntity> children = parent1.getChildren();
+        assertThat(children.size(), is(3));
+        UnidirJoinChildEntity child1 = parent1.getChildren().iterator().next();
+        parent1.removeChild(child1);
+        parent2.addChild(child1);
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        parent1 = repo.list().get(0);
+        parent2 = repo.list().get(0);
+        children = parent1.getChildren();
+        assertThat(children.size(), is(2));
+        
+        children = parent2.getChildren();
+        assertThat(children.size(), is(1));
+        iswf.commitTran();
+    }
+    
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java
new file mode 100644
index 0000000..b21f683
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/refs/Persistence_update_using_domMethodCalls.java
@@ -0,0 +1,113 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.refs;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencedEntityRepository;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntity;
+import org.apache.isis.tck.dom.refs.UnidirReferencingEntityRepository;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class Persistence_update_using_domMethodCalls {
+
+    private UnidirReferencingEntityRepository referencingRepo = new UnidirReferencingEntityRepository();
+    private UnidirReferencedEntityRepository referencedRepo = new UnidirReferencedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCINGENTITY"))
+        .with(Utils.listenerToDeleteFrom("UNIDIRREFERENCEDENTITY"))
+        .withServices(referencingRepo, referencedRepo)
+        .build();
+
+
+    @Test
+    public void persist_then_update() throws Exception {
+        
+        iswf.beginTran();
+        UnidirReferencedEntity referencedEntity1 = referencedRepo.newEntity();
+        referencedEntity1.setName("Referenced 1");
+        UnidirReferencedEntity referencedEntity2 = referencedRepo.newEntity();
+        referencedEntity2.setName("Referenced 2");
+
+        UnidirReferencingEntity referencingEntity1 = referencingRepo.newEntity();
+        referencingEntity1.setName("Referencing 1");
+        referencingEntity1.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity2 = referencingRepo.newEntity();
+        referencingEntity2.setName("Referencing 2");
+        referencingEntity2.setReferenced(referencedEntity1);
+        UnidirReferencingEntity referencingEntity3 = referencingRepo.newEntity();
+        referencingEntity3.setName("Referencing 3");
+        referencingEntity3.setReferenced(referencedEntity2);
+        
+        iswf.commitTran();
+        
+        // when ...
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<UnidirReferencingEntity> referencingList = referencingRepo.list();
+        referencingEntity1 = referencingList.get(0);
+        referencingEntity2 = referencingList.get(1);
+        referencingEntity3 = referencingList.get(2);
+
+        List<UnidirReferencedEntity> referencedList = referencedRepo.list();
+        referencedEntity1 = referencedList.get(0);
+        referencedEntity2 = referencedList.get(1);
+
+        assertThat(referencingEntity2.getReferenced(), is(referencedEntity1));
+
+        // ...switch to refer to other
+        referencingEntity2.setReferenced(referencedEntity2);
+        iswf.commitTran();
+
+        // then...
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        referencingList = referencingRepo.list();
+        referencingEntity1 = referencingList.get(0);
+        referencingEntity2 = referencingList.get(1);
+        referencingEntity3 = referencingList.get(2);
+
+        referencedList = referencedRepo.list();
+        referencedEntity1 = referencedList.get(0);
+        referencedEntity2 = referencedList.get(1);
+
+        // ...is switched
+        assertThat(referencingEntity2.getReferenced(), is(referencedEntity2));
+        iswf.commitTran();
+        
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.java
new file mode 100644
index 0000000..065882f
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_allInstances.java
@@ -0,0 +1,86 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class Persistence_allInstances {
+
+    private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void whenNoInstances() {
+        iswf.beginTran();
+        final List<PrimitiveValuedEntity> list = repo.list();
+        assertThat(list.size(), is(0));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persist_dontBounce_listAll() throws Exception {
+        
+        iswf.beginTran();
+        PrimitiveValuedEntity entity = repo.newEntity();
+        entity.setId(1);
+        entity = repo.newEntity();
+        entity.setId(2);
+        iswf.commitTran();
+
+        // don't bounce
+        iswf.beginTran();
+        List<PrimitiveValuedEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persist_bounce_listAll() throws Exception {
+        
+        iswf.beginTran();
+        repo.newEntity().setId(1);
+        repo.newEntity().setId(2);
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<PrimitiveValuedEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_bounceSystem.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_bounceSystem.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_bounceSystem.java
new file mode 100644
index 0000000..dadcee6
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_bounceSystem.java
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class Persistence_bounceSystem {
+
+    private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void bounceSystem() throws Exception {
+        iswf.bounceSystem();
+        iswf.bounceSystem();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_findInstance.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_findInstance.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_findInstance.java
new file mode 100644
index 0000000..7b0630d
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_findInstance.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class Persistence_findInstance {
+
+    private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void whenNoInstances() {
+        iswf.beginTran();
+        final PrimitiveValuedEntity entity = repo.findById(1);
+        assertThat(entity, is(nullValue()));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void whenAnInstance() throws Exception {
+        
+        iswf.beginTran();
+        repo.newEntity().setId(1);
+        iswf.commitTran();
+        
+        iswf.beginTran();
+        final PrimitiveValuedEntity entity = repo.findById(1);
+        assertThat(entity, is(not(nullValue())));
+        assertThat(entity.getId(), is(1));
+        iswf.commitTran();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_all.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_all.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_all.java
new file mode 100644
index 0000000..f4c6be9
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_all.java
@@ -0,0 +1,108 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import com.google.common.collect.ImmutableMap;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class Persistence_namedQuery_all {
+
+    private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Before
+    public void setUp() throws Exception {
+
+        iswf.beginTran();
+
+        PrimitiveValuedEntity entity = repo.newEntity();
+        entity.setId(1);
+        entity.setIntProperty(111);
+
+        entity = repo.newEntity();
+        entity.setId(2);
+        entity.setIntProperty(222);
+
+        entity = repo.newEntity();
+        entity.setId(3);
+        entity.setIntProperty(333);
+
+        entity = repo.newEntity();
+        entity.setId(4);
+        entity.setIntProperty(111);
+
+        iswf.commitTran();
+    }
+    
+    @Test
+    public void whenOne() throws Exception {
+        
+        iswf.beginTran();
+
+        List<PrimitiveValuedEntity> entities = repo.findByNamedQueryAll("prmv_findByIntProperty", ImmutableMap.of("i", (Object)222));
+        assertThat(entities, is(not(nullValue())));
+        assertThat(entities.size(), is(1));
+
+        iswf.commitTran();
+    }
+
+    @Test
+    public void whenTwo() throws Exception {
+        
+        iswf.beginTran();
+
+        List<PrimitiveValuedEntity> entities = repo.findByNamedQueryAll("prmv_findByIntProperty", ImmutableMap.of("i", (Object)111));
+        assertThat(entities, is(not(nullValue())));
+        assertThat(entities.size(), is(2));
+
+        iswf.commitTran();
+    }
+
+    @Test
+    public void whenNone() throws Exception {
+        
+        iswf.beginTran();
+
+        List<PrimitiveValuedEntity> entities = repo.findByNamedQueryAll("prmv_findByIntProperty", ImmutableMap.of("i", (Object)999));
+        assertThat(entities, is(not(nullValue())));
+        assertThat(entities.size(), is(0));
+
+        iswf.commitTran();
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_firstOnly.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_firstOnly.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_firstOnly.java
new file mode 100644
index 0000000..f9535ed
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_namedQuery_firstOnly.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertThat;
+
+import com.google.common.collect.ImmutableMap;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntity;
+import org.apache.isis.tck.dom.scalars.PrimitiveValuedEntityRepository;
+
+public class Persistence_namedQuery_firstOnly {
+
+    private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Before
+    public void setUp() throws Exception {
+
+        iswf.beginTran();
+
+        PrimitiveValuedEntity entity = repo.newEntity();
+        entity.setId(1);
+        entity.setIntProperty(111);
+
+        entity = repo.newEntity();
+        entity.setId(2);
+        entity.setIntProperty(222);
+
+        entity = repo.newEntity();
+        entity.setId(3);
+        entity.setIntProperty(333);
+
+        entity = repo.newEntity();
+        entity.setId(4);
+        entity.setIntProperty(111);
+
+        iswf.commitTran();
+
+    }
+    
+    @Test
+    public void whenOne() throws Exception {
+        
+        PrimitiveValuedEntity entity;
+        
+        iswf.beginTran();
+
+        entity = repo.findByNamedQueryFirstOnly("prmv_findByIntProperty", ImmutableMap.of("i", (Object)222));
+        assertThat(entity, is(not(nullValue())));
+        assertThat(entity.getId(), is(2));
+
+        iswf.commitTran();
+    }
+
+    @Test
+    public void whenTwo() throws Exception {
+        
+        PrimitiveValuedEntity entity;
+        
+        iswf.beginTran();
+
+        entity = repo.findByNamedQueryFirstOnly("prmv_findByIntProperty", ImmutableMap.of("i", (Object)111));
+        assertThat(entity, is(not(nullValue())));
+        assertThat(entity.getId(), is(1));
+
+        iswf.commitTran();
+    }
+
+    @Test
+    public void whenNone() throws Exception {
+        
+        PrimitiveValuedEntity entity;
+        
+        iswf.beginTran();
+
+        entity = repo.findByNamedQueryFirstOnly("prmv_findByIntProperty", ImmutableMap.of("i", (Object)999));
+        assertThat(entity, is(nullValue()));
+
+        iswf.commitTran();
+    }
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/255ef514/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java
new file mode 100644
index 0000000..d0dc357
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jdo/datanucleus/scenarios/scalar/Persistence_persistAndUpdate_applibValuedEntity.java
@@ -0,0 +1,92 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.scenarios.scalar;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.util.List;
+
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.applib.value.Date;
+import org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.Utils;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+import org.apache.isis.tck.dom.scalars.ApplibValuedEntity;
+import org.apache.isis.tck.dom.scalars.ApplibValuedEntityRepository;
+
+public class Persistence_persistAndUpdate_applibValuedEntity {
+
+    private ApplibValuedEntityRepository repo = new ApplibValuedEntityRepository();
+    
+    @Rule
+    public IsisSystemWithFixtures iswf = Utils.systemBuilder()
+        .with(Utils.listenerToDeleteFrom("APPLIBVALUEDENTITY"))
+        .withServices(repo)
+        .build();
+
+    @Test
+    public void persistTwo() throws Exception {
+        iswf.beginTran();
+        repo.newEntity().setStringProperty("1");
+        repo.newEntity().setStringProperty("2");
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        List<ApplibValuedEntity> list = repo.list();
+        assertThat(list.size(), is(2));
+        iswf.commitTran();
+    }
+
+    @Test
+    public void persist_then_update() throws Exception {
+        iswf.beginTran();
+        
+        ApplibValuedEntity entity = repo.newEntity();
+        entity.setStringProperty("1");
+
+        Date date = new Date();
+        entity.setDateProperty(date);
+        
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        entity = repo.list().get(0);
+        assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
+        
+        date = date.add(-1, -1, -1);
+        entity.setDateProperty(date);
+        
+        iswf.commitTran();
+
+        iswf.bounceSystem();
+        
+        iswf.beginTran();
+        entity = repo.list().get(0);
+        assertThat(entity.getDateProperty().dateValue(), is(date.dateValue()));
+        
+        iswf.commitTran();
+    }
+    
+}