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/13 01:01:06 UTC

[3/52] [partial] ISIS-188: renaming packages in line with groupId:artifactId

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/core/objectstore/jdo/applib/annotations/Auditable.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/core/objectstore/jdo/applib/annotations/Auditable.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/core/objectstore/jdo/applib/annotations/Auditable.java
new file mode 100644
index 0000000..09d0d87
--- /dev/null
+++ b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/core/objectstore/jdo/applib/annotations/Auditable.java
@@ -0,0 +1,39 @@
+/*
+ *  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.core.objectstore.jdo.applib.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that the entity is auditable.
+ * 
+ * <p>
+ * Alternatively, the type can implement the 
+ * {@link org.apache.isis.objectstore.jdo.applib.Auditable Auditable} marker interface.
+ */
+@Inherited
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Auditable {
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditService.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditService.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditService.java
new file mode 100644
index 0000000..b5a3a3a
--- /dev/null
+++ b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditService.java
@@ -0,0 +1,28 @@
+/*
+ *  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.objectstore.jdo.applib;
+
+import org.apache.isis.applib.annotation.Hidden;
+
+public interface AuditService {
+    
+    @Hidden
+    public void audit(String user, long currentTimestampEpoch, String objectType, String identifier, String preValue, String postValue);
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditServiceLogging.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditServiceLogging.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditServiceLogging.java
new file mode 100644
index 0000000..a2e6ca4
--- /dev/null
+++ b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/AuditServiceLogging.java
@@ -0,0 +1,35 @@
+/*
+ *  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.objectstore.jdo.applib;
+
+import org.apache.isis.applib.AbstractFactoryAndRepository;
+import org.apache.isis.applib.annotation.Hidden;
+import org.apache.log4j.Logger;
+
+public class AuditServiceLogging extends AbstractFactoryAndRepository  implements AuditService {
+    
+    private static Logger LOG = Logger.getLogger(AuditServiceLogging.class);
+    
+    @Hidden
+    public void audit(String user, long currentTimestampEpoch, String objectType, String identifier, String preValue, String postValue) {
+        String auditMessage = objectType + ":" + identifier + " by " + user + ": " + preValue + " -> " + postValue; 
+        LOG.info(auditMessage);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/Auditable.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/Auditable.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/Auditable.java
new file mode 100644
index 0000000..a06eaa0
--- /dev/null
+++ b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/objectstore/jdo/applib/Auditable.java
@@ -0,0 +1,26 @@
+/*
+ *  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.objectstore.jdo.applib;
+
+/**
+ * Marker interface to indicate that an entity should be audited.
+ */
+public interface Auditable {
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java
deleted file mode 100644
index 93cf643..0000000
--- a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  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.applib;
-
-import org.apache.isis.applib.annotation.Hidden;
-
-public interface AuditService {
-    
-    @Hidden
-    public void audit(String user, long currentTimestampEpoch, String objectType, String identifier, String preValue, String postValue);
-    
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java
deleted file mode 100644
index 7dd8297..0000000
--- a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/AuditServiceLogging.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *  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.applib;
-
-import org.apache.isis.applib.AbstractFactoryAndRepository;
-import org.apache.isis.applib.annotation.Hidden;
-import org.apache.log4j.Logger;
-
-public class AuditServiceLogging extends AbstractFactoryAndRepository  implements AuditService {
-    
-    private static Logger LOG = Logger.getLogger(AuditServiceLogging.class);
-    
-    @Hidden
-    public void audit(String user, long currentTimestampEpoch, String objectType, String identifier, String preValue, String postValue) {
-        String auditMessage = objectType + ":" + identifier + " by " + user + ": " + preValue + " -> " + postValue; 
-        LOG.info(auditMessage);
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java
deleted file mode 100644
index 96fe2ef..0000000
--- a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/Auditable.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *  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.applib;
-
-/**
- * Marker interface to indicate that an entity should be audited.
- */
-public interface Auditable {
-
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java b/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java
deleted file mode 100644
index 24444a6..0000000
--- a/component/objectstore/jdo/jdo-applib/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jdo/applib/annotations/Auditable.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *  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.applib.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates that the entity is auditable.
- * 
- * <p>
- * Alternatively, the type can implement the 
- * {@link org.apache.isis.runtimes.dflt.objectstores.jdo.applib.Auditable Auditable} marker interface.
- */
-@Inherited
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Auditable {
-}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml b/component/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml
index 426a18b..82d1d82 100644
--- a/component/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml
+++ b/component/objectstore/jdo/jdo-applib/src/main/resources/plugin.xml
@@ -25,42 +25,42 @@
         	persistent="true" 
         	dfg="true" 
         	embedded="true"
-            long-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateConverter"/>
+            long-converter="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisDateConverter"/>
         <java-type 
             name="org.apache.isis.applib.value.DateTime" 
             persistent="true" 
             dfg="true" 
             embedded="true"
-            long-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateTimeConverter"/>
+            long-converter="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisDateTimeConverter"/>
 
         <java-type 
             name="org.apache.isis.applib.value.Blob" 
             persistent="true" 
             dfg="false" 
             embedded="true"
-            string-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisBlobConverter"/>
+            string-converter="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisBlobConverter"/>
         <java-type 
             name="org.apache.isis.applib.value.Clob" 
             persistent="true" 
             dfg="false" 
             embedded="true"
-            string-converter="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisClobConverter"/>
+            string-converter="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisClobConverter"/>
     </extension>
 
     <extension point="org.datanucleus.store_mapping">
         <mapping 
             java-type="org.apache.isis.applib.value.Date" 
-            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateMapping"/>
+            mapping-class="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisDateMapping"/>
         <mapping 
             java-type="org.apache.isis.applib.value.DateTime" 
-            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisDateTimeMapping"/>
+            mapping-class="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisDateTimeMapping"/>
 
         <mapping 
             java-type="org.apache.isis.applib.value.Blob" 
-            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisBlobMapping"/>
+            mapping-class="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisBlobMapping"/>
         <mapping 
             java-type="org.apache.isis.applib.value.Clob" 
-            mapping-class="org.apache.isis.runtimes.dflt.objectstores.jdo.datanucleus.valuetypes.IsisClobMapping"/>
+            mapping-class="org.apache.isis.core.objectstore.jdo.datanucleus.valuetypes.IsisClobMapping"/>
 
     </extension>
 </plugin>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java
new file mode 100644
index 0000000..d73fb00
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusApplicationComponents.java
@@ -0,0 +1,161 @@
+/*
+ *  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.objectstore.jdo.datanucleus;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import com.google.common.collect.Maps;
+import com.google.common.collect.Sets;
+
+import org.datanucleus.NucleusContext;
+import org.datanucleus.api.jdo.JDOPersistenceManagerFactory;
+import org.datanucleus.store.schema.SchemaAwareStoreManager;
+
+import org.apache.isis.core.commons.components.ApplicationScopedComponent;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.IsisLifecycleListener;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly.JdoEmbeddedOnlyFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.query.JdoNamedQuery;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.query.JdoQueryFacet;
+
+public class DataNucleusApplicationComponents implements ApplicationScopedComponent {
+
+    private final PersistenceManagerFactory persistenceManagerFactory;
+    private final Map<String, JdoNamedQuery> namedQueryByName;
+    
+    private final IsisLifecycleListener lifecycleListener;
+    private final FrameworkSynchronizer synchronizer;
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    public DataNucleusApplicationComponents(final Map<String, String> props, final Collection<ObjectSpecification> objectSpecs) {
+        persistenceManagerFactory = JDOHelper.getPersistenceManagerFactory(props);
+        
+        final Set<String> classesToBePersisted = catalogClassesToBePersisted(objectSpecs);
+
+        createSchema(props, classesToBePersisted);
+
+        namedQueryByName = Collections.unmodifiableMap(catalogNamedQueries(objectSpecs));
+
+        synchronizer = new FrameworkSynchronizer();
+        lifecycleListener = new IsisLifecycleListener(synchronizer);
+    }
+    
+    private void createSchema(final Map<String, String> props, final Set<String> classesToBePersisted) {
+        final JDOPersistenceManagerFactory jdopmf = (JDOPersistenceManagerFactory)persistenceManagerFactory;
+        final NucleusContext nucleusContext = jdopmf.getNucleusContext();
+        final SchemaAwareStoreManager storeManager = (SchemaAwareStoreManager) nucleusContext.getStoreManager();
+        storeManager.createSchema(classesToBePersisted, asProperties(props));
+    }
+
+    private static Set<String> catalogClassesToBePersisted(Collection<ObjectSpecification> objectSpecs) {
+        Set<String> classNames = Sets.newTreeSet();
+        for (final ObjectSpecification spec : objectSpecs) {
+            if(spec.containsFacet(JdoPersistenceCapableFacet.class) || spec.containsFacet(JdoEmbeddedOnlyFacet.class)) {
+                classNames.add(spec.getFullIdentifier());
+            }
+        }
+        return Collections.unmodifiableSet(classNames);
+    }
+
+    private static Properties asProperties(Map<String, String> props) {
+        Properties properties = new Properties();
+        properties.putAll(props);
+        return properties;
+    }
+
+    private static Map<String, JdoNamedQuery> catalogNamedQueries(Collection<ObjectSpecification> objectSpecs) {
+        final Map<String, JdoNamedQuery> namedQueryByName = Maps.newHashMap();
+        for (final ObjectSpecification spec : objectSpecs) {
+            final JdoQueryFacet facet = spec.getFacet(JdoQueryFacet.class);
+            if (facet == null) {
+                continue;
+            }
+            for (final JdoNamedQuery namedQuery : facet.getNamedQueries()) {
+                namedQueryByName.put(namedQuery.getName(), namedQuery);
+            }
+        }
+        return namedQueryByName;
+    }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void init() {
+    }
+
+    @Override
+    public void shutdown() {
+    }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    // FrameworkSynchronizer
+    ///////////////////////////////////////////////////////////////////////////
+
+    public FrameworkSynchronizer getFrameworkSynchronizer() {
+        return synchronizer;
+    }
+
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+    
+    public PersistenceManager createPersistenceManager() {
+        PersistenceManager persistenceManager = persistenceManagerFactory.getPersistenceManager();
+        
+        persistenceManager.addInstanceLifecycleListener(lifecycleListener, (Class[])null);
+        return persistenceManager;
+    }
+
+    public JdoNamedQuery getNamedQuery(String queryName) {
+        return namedQueryByName.get(queryName);
+    }
+
+    
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    public void suspendListener() {
+        lifecycleListener.setSuspended(true);
+    }
+
+    public void resumeListener() {
+        lifecycleListener.setSuspended(false);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusException.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusException.java b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusException.java
new file mode 100644
index 0000000..31a19e5
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusException.java
@@ -0,0 +1,43 @@
+/*
+ *  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.objectstore.jdo.datanucleus;
+
+import org.apache.isis.core.runtime.persistence.ObjectPersistenceException;
+
+public class DataNucleusException extends ObjectPersistenceException {
+
+    private static final long serialVersionUID = 1L;
+
+    public DataNucleusException() {
+        super();
+    }
+
+    public DataNucleusException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public DataNucleusException(String message) {
+        super(message);
+    }
+
+    public DataNucleusException(Throwable cause) {
+        super(cause);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
new file mode 100644
index 0000000..c1974cd
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusObjectStore.java
@@ -0,0 +1,723 @@
+/*
+ *  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.objectstore.jdo.datanucleus;
+
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatArg;
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatContext;
+import static org.apache.isis.core.commons.ensure.Ensure.ensureThatState;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+
+import java.sql.Connection;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Map;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.spi.PersistenceCapable;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.apache.log4j.Logger;
+
+import org.apache.isis.core.commons.config.ConfigurationConstants;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.debug.DebugBuilder;
+import org.apache.isis.core.commons.exceptions.NotYetImplementedException;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.adapter.ResolveState;
+import org.apache.isis.core.metamodel.adapter.mgr.AdapterManager;
+import org.apache.isis.core.metamodel.adapter.oid.AggregatedOid;
+import org.apache.isis.core.metamodel.adapter.oid.Oid;
+import org.apache.isis.core.metamodel.adapter.oid.OidMarshaller;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.adapter.oid.TypedOid;
+import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.runtime.persistence.ObjectNotFoundException;
+import org.apache.isis.core.runtime.persistence.UnsupportedFindException;
+import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.CreateObjectCommand;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.DestroyObjectCommand;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.PersistenceCommand;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.SaveObjectCommand;
+import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindAllInstances;
+import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByPattern;
+import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindByTitle;
+import org.apache.isis.core.runtime.persistence.query.PersistenceQueryFindUsingApplibQueryDefault;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
+import org.apache.isis.core.runtime.system.persistence.PersistenceQuery;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.transaction.IsisTransaction;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.FrameworkSynchronizer.CalledFrom;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.commands.DataNucleusCreateObjectCommand;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.commands.DataNucleusDeleteObjectCommand;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.commands.DataNucleusUpdateObjectCommand;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindAllInstancesProcessor;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindByPatternProcessor;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindByTitleProcessor;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryFindUsingApplibQueryProcessor;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.PersistenceQueryProcessor;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.queries.QueryUtil;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.JdoObjectIdSerializer;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.query.JdoNamedQuery;
+
+public class DataNucleusObjectStore implements ObjectStoreSpi {
+
+    private static final Logger LOG = Logger.getLogger(DataNucleusObjectStore.class);
+
+    static enum State {
+        NOT_YET_OPEN, OPEN, CLOSED;
+    }
+
+    /**
+     * @see #isFixturesInstalled()
+     */
+    public static final String INSTALL_FIXTURES_KEY = ConfigurationConstants.ROOT + "persistor.datanucleus.install-fixtures";
+    public static final boolean INSTALL_FIXTURES_DEFAULT = false;
+
+    static enum TransactionMode {
+        /**
+         * Requires transactions to be started explicitly.
+         */
+        UNCHAINED,
+        /**
+         * Transactions are started automatically if not already in progress.
+         */
+        CHAINED;
+    }
+
+    private final ObjectAdapterFactory adapterFactory;
+    private final DataNucleusApplicationComponents applicationComponents;
+    
+    private final Map<ObjectSpecId, RootOid> registeredServices = Maps.newHashMap();
+
+    private PersistenceManager persistenceManager;
+
+    private final Map<Class<?>, PersistenceQueryProcessor<?>> persistenceQueryProcessorByClass = Maps.newHashMap();
+    private final FrameworkSynchronizer frameworkSynchronizer;
+
+    private State state;
+    private TransactionMode transactionMode;
+    
+
+    public DataNucleusObjectStore(ObjectAdapterFactory adapterFactory, DataNucleusApplicationComponents applicationComponents) {
+        ensureThatArg(adapterFactory, is(notNullValue()));
+        ensureThatArg(applicationComponents, is(notNullValue()));
+
+        this.state = State.NOT_YET_OPEN;
+        this.transactionMode = TransactionMode.UNCHAINED;
+
+        this.adapterFactory = adapterFactory;
+        this.applicationComponents = applicationComponents;
+        this.frameworkSynchronizer = applicationComponents.getFrameworkSynchronizer();
+    }
+
+    @Override
+    public String name() {
+        return "datanucleus";
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // open, close
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void open() {
+        ensureNotYetOpen();
+
+        openSession();
+        ensureThatState(persistenceManager, is(notNullValue()));
+
+        addPersistenceQueryProcessors(persistenceManager);
+
+        state = State.OPEN;
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p>
+     * Automatically {@link IsisTransactionManager#endTransaction() ends
+     * (commits)} the current (Isis) {@link Transaction}. This in turn
+     * {@link DataNucleusObjectStore#commitJdoTransaction() commits the underlying
+     * JPA transaction}.
+     * <p>
+     * The corresponding DataNucleus {@link Entity} is then
+     * {@link EntityManager#close() close}d.
+     */
+    public void close() {
+        ensureOpened();
+        ensureThatState(persistenceManager, is(notNullValue()));
+
+        final IsisTransaction currentTransaction = getTransactionManager().getTransaction();
+        if (currentTransaction != null && currentTransaction.getState().canCommit()) {
+            getTransactionManager().endTransaction();
+        }
+
+        persistenceManager.close();
+        state = State.CLOSED;
+    }
+
+    private PersistenceManager openSession() {
+        this.persistenceManager = applicationComponents.createPersistenceManager();
+        return this.persistenceManager;
+    }
+
+    private void addPersistenceQueryProcessors(final PersistenceManager persistenceManager) {
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindAllInstances.class, new PersistenceQueryFindAllInstancesProcessor(persistenceManager, frameworkSynchronizer));
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindByTitle.class, new PersistenceQueryFindByTitleProcessor(persistenceManager, frameworkSynchronizer));
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindByPattern.class, new PersistenceQueryFindByPatternProcessor(persistenceManager, frameworkSynchronizer));
+        persistenceQueryProcessorByClass.put(PersistenceQueryFindUsingApplibQueryDefault.class, new PersistenceQueryFindUsingApplibQueryProcessor(persistenceManager, frameworkSynchronizer));
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // isFixturesInstalled
+    // ///////////////////////////////////////////////////////////////////////
+
+    /**
+     * Implementation looks for the {@link #INSTALL_FIXTURES_KEY} in the
+     * {@link #getConfiguration() configuration}.
+     * <p>
+     * By default this is not expected to be there, but utilities can add in on
+     * the fly during bootstrapping if required.
+     */
+    public boolean isFixturesInstalled() {
+        return ! getConfiguration().getBoolean(INSTALL_FIXTURES_KEY, INSTALL_FIXTURES_DEFAULT);
+    }
+
+
+    // ///////////////////////////////////////////////////////////////////////
+    // reset
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void reset() {
+        // does nothing.
+    }
+
+    /**
+     * Non-API.
+     */
+    public Connection getJavaSqlConnection() {
+        return (Connection) persistenceManager.getDataStoreConnection().getNativeConnection();
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // TransactionMode (not API)
+    // ///////////////////////////////////////////////////////////////////////
+
+    public TransactionMode getTransactionMode() {
+        return transactionMode;
+    }
+
+    public void setTransactionMode(final TransactionMode transactionMode) {
+        ensureNotInTransaction();
+        this.transactionMode = transactionMode;
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Transactions
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void startTransaction() {
+        beginJdoTransaction();
+    }
+
+    public void endTransaction() {
+        commitJdoTransaction();
+    }
+
+    public void abortTransaction() {
+        rollbackJpaTransaction();
+    }
+
+    private void beginJdoTransaction() {
+        final javax.jdo.Transaction transaction = getPersistenceManager().currentTransaction();
+        if (transaction.isActive()) {
+            throw new IllegalStateException("Transaction already active");
+        }
+        transaction.begin();
+    }
+
+    private void commitJdoTransaction() {
+        final javax.jdo.Transaction transaction = getPersistenceManager().currentTransaction();
+        if (transaction.isActive()) {
+            transaction.commit();
+        }
+    }
+
+    private void rollbackJpaTransaction() {
+        final javax.jdo.Transaction transaction = getPersistenceManager().currentTransaction();
+        if (transaction.isActive()) {
+            transaction.rollback();
+        }
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Command Factory
+    // ///////////////////////////////////////////////////////////////////////
+
+    public CreateObjectCommand createCreateObjectCommand(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInSession();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("create object - creating command for: " + adapter);
+        }
+        if (adapter.representsPersistent()) {
+            throw new IllegalArgumentException("Adapter is persistent; adapter: " + adapter);
+        }
+        return new DataNucleusCreateObjectCommand(adapter, getPersistenceManager());
+    }
+
+    public SaveObjectCommand createSaveObjectCommand(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInSession();
+
+        if (!adapter.representsPersistent()) {
+            throw new IllegalArgumentException("Adapter is not persistent; adapter: " + adapter);
+        }
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("save object - creating command for: " + adapter);
+        }
+        return new DataNucleusUpdateObjectCommand(adapter, getPersistenceManager());
+    }
+
+    public DestroyObjectCommand createDestroyObjectCommand(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInSession();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("destroy object - creating command for: " + adapter);
+        }
+        if (!adapter.representsPersistent()) {
+            throw new IllegalArgumentException("Adapter is not persistent; adapter: " + adapter);
+        }
+        return new DataNucleusDeleteObjectCommand(adapter, getPersistenceManager());
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Execute
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void execute(final List<PersistenceCommand> commands) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("execute " + commands.size() + " commands");
+        }
+
+        if (commands.size() <= 0) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("no commands");
+            }
+            return;
+        }
+
+        executeCommands(commands);
+    }
+
+    private void executeCommands(final List<PersistenceCommand> commands) {
+        try {
+            for (final PersistenceCommand command : commands) {
+                command.execute(null);
+            }
+            getPersistenceManager().flush();
+        } catch (final RuntimeException e) {
+            LOG.warn("Failure during execution", e);
+            throw e;
+        }
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // loadMappedObject, resolveImmediately, resolveField
+    // ///////////////////////////////////////////////////////////////////////
+
+    public ObjectAdapter loadInstanceAndAdapt(final TypedOid oid) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("getObject; oid=" + oid);
+        }
+
+        final Object pojo = loadPojo(oid);
+        return getPersistenceSession().mapRecreatedPojo(oid, pojo);
+    }
+
+    
+    
+    /////////////////////////////////////////////////////////////
+    // delegated to by PojoRecreator
+    /////////////////////////////////////////////////////////////
+
+    public Object loadPojo(final TypedOid oid) {
+    	
+        // REVIEW: does it make sense to get these directly?  not sure, so for now have decided to fail fast. 
+        if(oid instanceof AggregatedOid) {
+            throw new UnsupportedOperationException("Cannot retrieve aggregated objects directly, oid: " + oid.enString(getOidMarshaller()));
+        }
+        
+        final RootOid rootOid = (RootOid) oid;
+        
+        Object result = null;
+        try {
+            final Class<?> cls = clsOf(rootOid);
+            final Object jdoObjectId = JdoObjectIdSerializer.toJdoObjectId(rootOid);
+            result = getPersistenceManager().getObjectById(cls, jdoObjectId);
+        } catch (final RuntimeException e) {
+            throw e;
+        }
+
+        if (result == null) {
+            throw new ObjectNotFoundException(oid);
+        }
+        return result;
+    }
+
+    
+    public ObjectAdapter lazilyLoaded(Object pojo) {
+        if(!(pojo instanceof PersistenceCapable)) {
+            return null;
+        } 
+        final PersistenceCapable persistenceCapable = (PersistenceCapable) pojo;
+        return frameworkSynchronizer.lazilyLoaded(persistenceCapable, CalledFrom.OS_LAZILYLOADED);
+    }
+
+
+
+    /**
+     * Will do nothing if object is already resolved or if object is transient.
+     * <p>
+     * TODO:
+     * The final {@link ResolveState} of the adapter is set using
+     * {@link NakedLoadPostEventListener#onPostLoad(org.hibernate.event.PostLoadEvent)}
+     * Note: this is the same behaviour as MemoryObjectStore, XmlObjectStore
+     * and HibernateObjectStore.
+     * <p>
+     * REVIEW: if the initial state is RESOLVING_PART, then the
+     * {@link ResolveState} is not changed. Is this right?
+     */
+    public void resolveImmediately(final ObjectAdapter adapter) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("resolveImmediately; oid=" + adapter.getOid().enString(getOidMarshaller()));
+        }
+
+        if (adapter.isResolved()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("; already resolved - ignoring");
+            }
+            return;
+        }
+        if (!adapter.representsPersistent()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("; not persistent - ignoring");
+            }
+            return;
+        }
+
+        final Oid oid = adapter.getOid();
+        if (oid instanceof AggregatedOid) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("; aggregated - resolving parent");
+            }
+            final AggregatedOid aggregatedOid = (AggregatedOid) oid;
+            final TypedOid parentOid = aggregatedOid.getParentOid();
+            final ObjectAdapter parentAdapter = loadInstanceAndAdapt(parentOid);
+            resolveImmediately(parentAdapter);
+            return;
+        }
+
+        // REVIEW: is this possible?
+        final Object domainObject = adapter.getObject();
+		if (domainObject == null) {
+            throw new ObjectNotFoundException(adapter.getOid());
+        }
+
+        try {
+            getPersistenceManager().refresh(domainObject);
+        } catch (final RuntimeException e) {
+            throw new ObjectNotFoundException(adapter.getOid(), e);
+        }
+
+        // possibly redundant because also called in the post-load event
+        // listener, but (with JPA impl) found it was required if we were ever to 
+        // get an eager left-outer-join as the result of a refresh (sounds possible).
+        
+        frameworkSynchronizer.postLoadProcessingFor((PersistenceCapable) domainObject, CalledFrom.OS_RESOLVE);
+    }
+
+    /**
+     * Walking the graph.
+     */
+    public void resolveField(final ObjectAdapter object, final ObjectAssociation association) {
+        ensureOpened();
+        ensureInTransaction();
+
+        final ObjectAdapter referencedCollectionAdapter = association.get(object);
+
+        // this code originally brought in from the JPA impl, but seems reasonable.
+        if (association.isOneToManyAssociation()) {
+            ensureThatState(referencedCollectionAdapter, is(notNullValue()));
+
+            final Object referencedCollection = referencedCollectionAdapter.getObject();
+            ensureThatState(referencedCollection, is(notNullValue()));
+
+            // if a proxy collection, then force it to initialize.  just 'touching' the object is sufficient.
+            // REVIEW: I wonder if this is actually needed; does JDO use proxy collections?
+            referencedCollection.hashCode();
+        }
+
+        // the JPA impl used to also call its lifecycle listener on the referenced collection object, eg List,
+        // itself.  I don't think this makes sense to do for JDO (the collection is not a PersistenceCapable).
+    }
+
+    
+    // ///////////////////////////////////////////////////////////////////////
+    // getInstances, hasInstances
+    // ///////////////////////////////////////////////////////////////////////
+
+    public List<ObjectAdapter> loadInstancesAndAdapt(final PersistenceQuery persistenceQuery) {
+        ensureOpened();
+        ensureInTransaction();
+
+        final PersistenceQueryProcessor<? extends PersistenceQuery> processor = persistenceQueryProcessorByClass.get(persistenceQuery.getClass());
+        if (processor == null) {
+            throw new UnsupportedFindException(MessageFormat.format("Unsupported criteria type: {0}", persistenceQuery.getClass().getName()));
+        }
+        return processPersistenceQuery(processor, persistenceQuery);
+    }
+
+    @SuppressWarnings("unchecked")
+    private <Q extends PersistenceQuery> List<ObjectAdapter> processPersistenceQuery(final PersistenceQueryProcessor<Q> persistenceQueryProcessor, final PersistenceQuery persistenceQuery) {
+        return persistenceQueryProcessor.process((Q)persistenceQuery);
+    }
+
+    public boolean hasInstances(final ObjectSpecification specification) {
+        ensureOpened();
+        ensureInTransaction();
+
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("hasInstances: class=" + specification.getFullIdentifier());
+        }
+
+        if (!specification.persistability().isPersistable()) {
+            LOG.warn("hasInstances: trying to run for non-persistent class " + specification);
+            return false;
+        }
+
+        final Query query = QueryUtil.createQuery(getPersistenceManager(), "o", "select o.id", specification, null);
+        throw new NotYetImplementedException();
+        //query.set.setMaxResults(1);
+        //return !query.getResultList().isEmpty();
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Helpers (loadObjects)
+    // ///////////////////////////////////////////////////////////////////////
+
+    @SuppressWarnings("unused")
+    private List<ObjectAdapter> loadObjects(final ObjectSpecification specification, final List<?> listOfPojs, final AdapterManagerSpi adapterManager) {
+        final List<ObjectAdapter> adapters = Lists.newArrayList();
+        int i = 0;
+        for (final Object pojo : listOfPojs) {
+            // REVIEW: cannot just load adapter for object - if Naked Objects
+            // has
+            // already loaded the object
+            // then object won't match it (e.g. if getInstances has been called
+            // and an instance has
+            // been loaded) - so need to use Hibernate session to get an Oid to
+            // do a lookup in that case
+            adapters.add(adapterManager.getAdapterFor(pojo));
+        }
+        return adapters;
+    }
+
+    
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Services
+    // ///////////////////////////////////////////////////////////////////////
+
+    @Override
+    public void registerService(RootOid rootOid) {
+        ensureOpened();
+        this.registeredServices.put(rootOid.getObjectSpecId(), rootOid);
+    }
+
+    @Override
+    public RootOid getOidForService(ObjectSpecification serviceSpec) {
+        ensureOpened();
+        return this.registeredServices.get(serviceSpec.getSpecId());
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Helpers: ensure*
+    // ///////////////////////////////////////////////////////////////////////
+
+    private void ensureNotYetOpen() {
+        ensureStateIs(State.NOT_YET_OPEN);
+    }
+
+    private void ensureOpened() {
+        ensureStateIs(State.OPEN);
+    }
+
+    private void ensureInSession() {
+        ensureThatContext(IsisContext.inSession(), is(true));
+    }
+
+    private void ensureNotInTransaction() {
+        ensureInSession();
+        ensureThatContext(IsisContext.inTransaction(), is(false));
+    }
+
+    private void ensureInTransaction() {
+        if (transactionMode == TransactionMode.UNCHAINED) {
+            ensureThatContext(IsisContext.inTransaction(), is(true));
+            ensureInHibernateTransaction();
+        } else {
+            ensureInSession();
+            if (IsisContext.inTransaction()) {
+                ensureInHibernateTransaction();
+            } else {
+                getTransactionManager().startTransaction();
+            }
+        }
+    }
+
+    private void ensureInHibernateTransaction() {
+        javax.jdo.Transaction currentTransaction = getPersistenceManager().currentTransaction();
+        ensureThatState(currentTransaction, is(notNullValue()));
+        ensureThatState(currentTransaction.isActive(), is(true));
+    }
+
+    private void ensureStateIs(final State stateRequired) {
+        if (state == stateRequired) {
+            return;
+        }
+        throw new IllegalStateException("State is: " + state + "; should be: " + stateRequired);
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Debugging
+    // ///////////////////////////////////////////////////////////////////////
+
+    public void debugData(final DebugBuilder debug) {
+        throw new NotYetImplementedException();
+    }
+
+    public String debugTitle() {
+        throw new NotYetImplementedException();
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // non-API
+    // ///////////////////////////////////////////////////////////////////////
+
+    public JdoNamedQuery getNamedQuery(String queryName) {
+        return applicationComponents.getNamedQuery(queryName);
+    }
+
+    /**
+     * For testing purposes, to allow fixtures to use JDO to initialize the
+     * database without triggering the objectstore.
+     * 
+     * @see #resumeListener()
+     */
+    public void suspendListener() {
+        applicationComponents.suspendListener();
+    }
+
+    /**
+     * For testing purposes, to allow fixtures to use JDO to initialize the
+     * database without triggering the objectstore.
+     * 
+     * @see #suspendListener()
+     */
+    public void resumeListener() {
+        applicationComponents.resumeListener();
+    }
+
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Helpers
+    // ///////////////////////////////////////////////////////////////////////
+
+    private Class<?> clsOf(final TypedOid oid) {
+        final ObjectSpecification objectSpec = getSpecificationLoader().lookupBySpecId(oid.getObjectSpecId());
+        return objectSpec.getCorrespondingClass();
+    }
+
+    /**
+     * Intended for internal and test use only.
+     */
+    public PersistenceManager getPersistenceManager() {
+        return persistenceManager;
+    }
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Dependencies (from constructor)
+    // ///////////////////////////////////////////////////////////////////////
+
+    public ObjectAdapterFactory getAdapterFactory() {
+        return adapterFactory;
+    }
+
+
+    // ///////////////////////////////////////////////////////////////////////
+    // Dependencies (from context)
+    // ///////////////////////////////////////////////////////////////////////
+
+    public IsisConfiguration getConfiguration() {
+        return IsisContext.getConfiguration();
+    }
+
+    protected SpecificationLoaderSpi getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+    protected PersistenceSession getPersistenceSession() {
+        return IsisContext.getPersistenceSession();
+    }
+
+    protected AdapterManager getAdapterManager() {
+        return getPersistenceSession().getAdapterManager();
+    }
+    
+    protected IsisTransactionManager getTransactionManager() {
+        return IsisContext.getTransactionManager();
+    }
+
+    protected OidMarshaller getOidMarshaller() {
+        return IsisContext.getOidMarshaller();
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
new file mode 100644
index 0000000..a671763
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/DataNucleusPersistenceMechanismInstaller.java
@@ -0,0 +1,261 @@
+/*
+ *  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.objectstore.jdo.datanucleus;
+
+import java.util.List;
+import java.util.Map;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+import org.apache.isis.core.commons.components.Installer;
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
+import org.apache.isis.core.metamodel.progmodel.ProgrammingModel;
+import org.apache.isis.core.metamodel.spec.SpecificationLoaderSpi;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutor;
+import org.apache.isis.core.metamodel.specloader.validator.MetaModelValidatorComposite;
+import org.apache.isis.core.progmodel.facets.object.ignore.jdo.RemoveJdoEnhancementTypesFacetFactory;
+import org.apache.isis.core.progmodel.facets.object.ignore.jdo.RemoveJdoPrefixedMethodsFacetFactory;
+import org.apache.isis.core.runtime.bytecode.identity.ObjectFactoryBasic;
+import org.apache.isis.core.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
+import org.apache.isis.core.runtime.persistence.objectstore.ObjectStoreSpi;
+import org.apache.isis.core.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
+import org.apache.isis.core.runtime.persistence.objectstore.transaction.TransactionalResource;
+import org.apache.isis.core.runtime.system.context.IsisContext;
+import org.apache.isis.core.runtime.system.persistence.AdapterManagerSpi;
+import org.apache.isis.core.runtime.system.persistence.IdentifierGenerator;
+import org.apache.isis.core.runtime.system.persistence.ObjectFactory;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory;
+import org.apache.isis.core.runtime.system.transaction.EnlistedObjectDirtying;
+import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
+import org.apache.isis.objectstore.jdo.applib.AuditService;
+import org.apache.isis.objectstore.jdo.datanucleus.bytecode.DataNucleusTypesClassSubstitutor;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.adaptermanager.DataNucleusPojoRecreator;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.DataNucleusIdentifierGenerator;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.DataNucleusSimplePersistAlgorithm;
+import org.apache.isis.objectstore.jdo.datanucleus.persistence.spi.DataNucleusTransactionManager;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.auditable.AuditableMarkerInterfaceFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.datastoreidentity.JdoDatastoreIdentityAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.discriminator.JdoDiscriminatorAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.embeddedonly.JdoEmbeddedOnlyAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.query.JdoQueryAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.facets.prop.primarykey.JdoPrimaryKeyAnnotationFacetFactory;
+import org.apache.isis.objectstore.jdo.metamodel.specloader.validator.JdoMetaModelValidator;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+/**
+ * Configuration files are read in the usual fashion (as per {@link Installer#getConfigurationResources()}, ie will consult all of:
+ * <ul>
+ * <li><tt>persistor_datanucleus.properties</tt>
+ * <li><tt>persistor.properties</tt>
+ * <li><tt>isis.properties</tt>
+ * </ul>
+ * 
+ * <p>
+ * With respect to configuration, all properties under {@value #ISIS_CONFIG_PREFIX} prefix are passed 
+ * through verbatim to the DataNucleus runtime. For example:
+ * <table>
+ * <tr><th>Isis Property</th><th>DataNucleus Property</th></tr>
+ * <tr><td><tt>isis.persistor.datanucleus.impl.datanucleus.foo.Bar</tt></td><td><tt>datanucleus.foo.Bar</tt></td></tr>
+ * </table>
+ *
+ */
+public class DataNucleusPersistenceMechanismInstaller extends PersistenceMechanismInstallerAbstract {
+
+    private static final Predicate<Object> LOCATE_AUDIT_SERVICE = new Predicate<Object>() {
+
+        @Override
+        public boolean apply(Object input) {
+            return input instanceof AuditService;
+        }
+    };
+
+    public static final String NAME = "datanucleus";
+    private static final String ISIS_CONFIG_PREFIX = "isis.persistor.datanucleus.impl";
+
+    private DataNucleusApplicationComponents applicationComponents = null;
+
+    // only search once
+    private boolean searchedForAuditService;
+    private AuditService auditService;
+    
+    public DataNucleusPersistenceMechanismInstaller() {
+        super(NAME);
+    }
+
+    
+    ////////////////////////////////////////////////////////////////////////
+    // createObjectStore
+    ////////////////////////////////////////////////////////////////////////
+    
+    @Override
+    protected ObjectStoreSpi createObjectStore(IsisConfiguration configuration, ObjectAdapterFactory adapterFactory, AdapterManagerSpi adapterManager) {
+        createDataNucleusApplicationComponentsIfRequired(configuration);
+        return new DataNucleusObjectStore(adapterFactory, applicationComponents);
+    }
+
+    private void createDataNucleusApplicationComponentsIfRequired(IsisConfiguration configuration) {
+        if(applicationComponents != null) {
+            return;
+        }
+        
+        final IsisConfiguration dataNucleusConfig = configuration.createSubset(ISIS_CONFIG_PREFIX);
+        final Map<String, String> props = dataNucleusConfig.asMap();
+        addDataNucleusPropertiesIfRequired(props);
+        
+        applicationComponents = new DataNucleusApplicationComponents(props, getSpecificationLoader().allSpecifications());
+    }
+
+
+    private static void addDataNucleusPropertiesIfRequired(
+            final Map<String, String> props) {
+        putIfNotPresent(props, "javax.jdo.PersistenceManagerFactoryClass", "org.datanucleus.api.jdo.JDOPersistenceManagerFactory");
+        
+        putIfNotPresent(props, "javax.jdo.option.ConnectionDriverName", "org.hsqldb.jdbcDriver");
+        putIfNotPresent(props, "javax.jdo.option.ConnectionURL", "jdbc:hsqldb:mem:test");
+        putIfNotPresent(props, "javax.jdo.option.ConnectionUserName", "sa");
+        putIfNotPresent(props, "javax.jdo.option.ConnectionPassword", "");
+        
+        putIfNotPresent(props, "datanucleus.autoCreateSchema", "true");
+        putIfNotPresent(props, "datanucleus.validateSchema", "true");
+        putIfNotPresent(props, "datanucleus.cache.level2.type", "none");
+    }
+
+
+    private static void putIfNotPresent(
+        final Map<String, String> props,
+        String key,
+        String value) {
+        if(!props.containsKey(key)) {
+            props.put(key, value);
+        }
+    }
+
+    ////////////////////////////////////////////////////////////////////////
+    // createPersistenceSession
+    ////////////////////////////////////////////////////////////////////////
+
+    @Override
+    public PersistenceSession createPersistenceSession(PersistenceSessionFactory persistenceSessionFactory) {
+        PersistenceSession persistenceSession = super.createPersistenceSession(persistenceSessionFactory);
+        searchAndCacheAuditServiceIfNotAlreadyDoneSo(persistenceSessionFactory);
+        return persistenceSession;
+    }
+
+    private void searchAndCacheAuditServiceIfNotAlreadyDoneSo(PersistenceSessionFactory persistenceSessionFactory) {
+        if(searchedForAuditService) {
+            return;
+        } 
+        List<Object> services = persistenceSessionFactory.getServices();
+        final Optional<Object> optionalService = Iterables.tryFind(services, LOCATE_AUDIT_SERVICE);
+        if(optionalService.isPresent()) {
+            auditService = (AuditService) optionalService.get();
+        }
+        searchedForAuditService = true;
+    }
+
+    ////////////////////////////////////////////////////////////////////////
+    // PersistenceSessionFactoryDelegate impl
+    ////////////////////////////////////////////////////////////////////////
+
+    @Override
+    protected PersistAlgorithm createPersistAlgorithm(IsisConfiguration configuration) {
+        return new DataNucleusSimplePersistAlgorithm();
+    }
+    
+    @Override
+    public IdentifierGenerator createIdentifierGenerator(IsisConfiguration configuration) {
+        return new DataNucleusIdentifierGenerator();
+    }
+
+    @Override
+    public ClassSubstitutor createClassSubstitutor(IsisConfiguration configuration) {
+        return new DataNucleusTypesClassSubstitutor();
+    }
+
+    @Override
+    public void refineProgrammingModel(ProgrammingModel programmingModel, IsisConfiguration configuration) {
+        addJdoFacetFactoriesTo(programmingModel);
+        addDataNucleusFacetFactoriesTo(programmingModel);
+    }
+
+    private void addJdoFacetFactoriesTo(ProgrammingModel baseProgrammingModel) {
+        baseProgrammingModel.addFactory(JdoPersistenceCapableAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(JdoDatastoreIdentityAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(JdoEmbeddedOnlyAnnotationFacetFactory.class);
+
+        baseProgrammingModel.addFactory(JdoPrimaryKeyAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(JdoDiscriminatorAnnotationFacetFactory.class);
+
+        baseProgrammingModel.addFactory(JdoQueryAnnotationFacetFactory.class);
+        
+        baseProgrammingModel.addFactory(AuditableAnnotationFacetFactory.class);
+        baseProgrammingModel.addFactory(AuditableMarkerInterfaceFacetFactory.class);
+    }
+
+    private void addDataNucleusFacetFactoriesTo(ProgrammingModel baseProgrammingModel) {
+        baseProgrammingModel.addFactory(RemoveJdoEnhancementTypesFacetFactory.class);
+        baseProgrammingModel.addFactory(RemoveJdoPrefixedMethodsFacetFactory.class);
+    }
+
+    @Override
+    public void refineMetaModelValidator(MetaModelValidatorComposite metaModelValidator, IsisConfiguration configuration) {
+        metaModelValidator.add(new JdoMetaModelValidator());
+    }
+
+
+    @Override
+    protected IsisTransactionManager createTransactionManager(final EnlistedObjectDirtying persistor, final TransactionalResource objectStore) {
+        return new DataNucleusTransactionManager(persistor, objectStore, auditService);
+    }
+
+    @Override
+    public ObjectFactory createObjectFactory(IsisConfiguration configuration) {
+        return new ObjectFactoryBasic();
+    }
+
+    @Override
+    public DataNucleusPojoRecreator createPojoRecreator(IsisConfiguration configuration) {
+        return new DataNucleusPojoRecreator();
+    }
+
+
+
+
+    
+    ////////////////////////////////////////////////////////////////////////
+    // Dependencies
+    ////////////////////////////////////////////////////////////////////////
+    
+    protected SpecificationLoaderSpi getSpecificationLoader() {
+        return IsisContext.getSpecificationLoader();
+    }
+
+
+
+
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/JdoRuntimeException.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/JdoRuntimeException.java b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/JdoRuntimeException.java
new file mode 100644
index 0000000..3b80459
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/JdoRuntimeException.java
@@ -0,0 +1,34 @@
+/*
+ *  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.objectstore.jdo.datanucleus;
+
+public class JdoRuntimeException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+
+    public JdoRuntimeException() {
+        super();
+    }
+
+    public JdoRuntimeException(String arg0) {
+        super(arg0);
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/bytecode/DataNucleusTypesClassSubstitutor.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/bytecode/DataNucleusTypesClassSubstitutor.java b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/bytecode/DataNucleusTypesClassSubstitutor.java
new file mode 100644
index 0000000..054c1da
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/bytecode/DataNucleusTypesClassSubstitutor.java
@@ -0,0 +1,40 @@
+/*
+ *  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.objectstore.jdo.datanucleus.bytecode;
+
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.CglibEnhanced;
+import org.apache.isis.core.metamodel.specloader.classsubstitutor.ClassSubstitutorAbstract;
+
+public class DataNucleusTypesClassSubstitutor extends ClassSubstitutorAbstract {
+
+    /**
+     * If {@link CglibEnhanced} then return superclass, else as per
+     * {@link ClassSubstitutorAbstract#getClass(Class) superclass'}
+     * implementation.
+     */
+    @Override
+    public Class<?> getClass(final Class<?> cls) {
+        if(cls.getName().startsWith("org.datanucleus")) {
+            return getClass(cls.getSuperclass());
+        }
+        return super.getClass(cls);
+    }
+
+    
+}

http://git-wip-us.apache.org/repos/asf/isis/blob/951a0fe4/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/metamodel/JdoPropertyUtils.java
----------------------------------------------------------------------
diff --git a/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/metamodel/JdoPropertyUtils.java b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/metamodel/JdoPropertyUtils.java
new file mode 100644
index 0000000..a73582b
--- /dev/null
+++ b/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/isis/objectstore/jdo/datanucleus/metamodel/JdoPropertyUtils.java
@@ -0,0 +1,68 @@
+/*
+ *  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.objectstore.jdo.datanucleus.metamodel;
+
+import java.text.MessageFormat;
+import java.util.List;
+
+import javax.jdo.annotations.PrimaryKey;
+
+import org.apache.isis.applib.filter.Filter;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.feature.ObjectAssociation;
+import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
+import org.apache.isis.objectstore.jdo.metamodel.facets.object.persistencecapable.JdoPersistenceCapableFacet;
+import org.apache.isis.objectstore.jdo.metamodel.util.JdoPrimaryKeyPropertyFilter;
+
+public final class JdoPropertyUtils {
+
+    private JdoPropertyUtils() {
+    }
+
+    /**
+     * Searches for the property annotated with {@link PrimaryKey}.
+     * <p>
+     * Returns the {@link OneToOneAssociation} if there is precisely one; else
+     * <tt>null</tt>.
+     * 
+     * @see JdoPrimaryKeyPropertyFilter
+     */
+    public static OneToOneAssociation getPrimaryKeyPropertyFor(final ObjectSpecification objectSpec) {
+        return getPropertyFor(objectSpec, "@PrimaryKey", new JdoPrimaryKeyPropertyFilter());
+    }
+
+    public static boolean hasPrimaryKeyProperty(final ObjectSpecification objectSpec) {
+        return getPrimaryKeyPropertyFor(objectSpec) != null;
+    }
+    
+    private static OneToOneAssociation getPropertyFor(final ObjectSpecification objSpec, final String annotationName, final Filter<ObjectAssociation> filter) {
+        if (objSpec == null || !objSpec.containsFacet(JdoPersistenceCapableFacet.class)) {
+            return null;
+        }
+        final List<? extends ObjectAssociation> propertyList = objSpec.getAssociations(filter);
+        if (propertyList.size() == 0) {
+            return JdoPropertyUtils.getPropertyFor(objSpec.superclass(), annotationName, filter);
+        }
+        if (propertyList.size() > 1) {
+            throw new IllegalStateException(MessageFormat.format("Shouldn''t have more than one property annotated with {0} (''{1}'')", annotationName, objSpec.getFullIdentifier()));
+        }
+        return (OneToOneAssociation) propertyList.get(0);
+    }
+
+}