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/05/30 09:33:52 UTC
svn commit: r1344132 - in /incubator/isis/trunk/framework:
core/commons/src/test/java/org/apache/isis/core/commons/config/
runtimes/dflt/objectstores/jpa/ runtimes/dflt/objectstores/jpa/jpa-applib/
runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/ja...
Author: danhaywood
Date: Wed May 30 07:33:50 2012
New Revision: 1344132
URL: http://svn.apache.org/viewvc?rev=1344132&view=rev
Log:
ISIS-48: more on openjpa object store
Added:
incubator/isis/trunk/framework/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java (with props)
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/IsisLifecycleListener.java (with props)
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/facets/
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/facets/RemoveOpenJpaEnhancementTypesFacetFactory.java (with props)
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/progmodelfacets/
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/progmodelfacets/OpenJpaProgrammingModelFacets.java (with props)
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/Utils.java (with props)
Removed:
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaSimplePersistAlgorithm.java
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/fixtures/
Modified:
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-applib/pom.xml
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstaller.java
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryFindAllInstancesProcessor.java
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryProcessorAbstract.java
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaIdentifierGenerator.java
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaSimplePersistAlgorithm.java
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstallerTest_openAndClose.java
incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/pom.xml
incubator/isis/trunk/framework/tck/pom.xml
incubator/isis/trunk/framework/tck/tck-dom/pom.xml
incubator/isis/trunk/framework/tck/tck-dom/src/main/java/org/apache/isis/tck/dom/scalars/PrimitiveValuedEntity.java
Added: incubator/isis/trunk/framework/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java?rev=1344132&view=auto
==============================================================================
--- incubator/isis/trunk/framework/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java (added)
+++ incubator/isis/trunk/framework/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java Wed May 30 07:33:50 2012
@@ -0,0 +1,82 @@
+package org.apache.isis.core.commons.config;
+
+import static org.hamcrest.CoreMatchers.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+
+import org.jmock.auto.Mock;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2;
+import org.apache.isis.core.testsupport.jmock.JUnitRuleMockery2.Mode;
+
+public class IsisConfigurationDefaultTest_createSubset {
+
+ private IsisConfigurationDefault configuration;
+
+ @Before
+ public void setUp() throws Exception {
+ configuration = new IsisConfigurationDefault();
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ configuration = null;
+ }
+
+ @Test
+ public void empty() {
+ final IsisConfiguration subset = configuration.createSubset("foo");
+ assertThat(subset.iterator().hasNext(), is(false));
+ }
+
+ @Test
+ public void nonEmptyButNoneInSubset() {
+ configuration.add("bar", "barValue");
+ final IsisConfiguration subset = configuration.createSubset("foo");
+ assertThat(subset.iterator().hasNext(), is(false));
+ }
+
+ @Test
+ public void nonEmptyButSingleKeyedInSubset() {
+ configuration.add("foo", "fooValue");
+ final IsisConfiguration subset = configuration.createSubset("foo");
+ final Iterator<String> iterator = subset.iterator();
+ assertThat(iterator.hasNext(), is(false));
+ }
+
+ @Test
+ public void nonEmptyAndMultiKeyedInSubset() {
+ configuration.add("foo.foz", "fozValue");
+ final IsisConfiguration subset = configuration.createSubset("foo");
+ final Iterator<String> iterator = subset.iterator();
+ assertThat(iterator.hasNext(), is(true));
+ assertThat(iterator.next(), is("foz"));
+ assertThat(iterator.hasNext(), is(false));
+ assertThat(subset.getString("foz"), is("fozValue"));
+ }
+
+ @Test
+ public void propertiesOutsideOfSubsetAreIgnored() {
+ configuration.add("foo.foz", "fozValue");
+ configuration.add("foo.faz", "fazValue");
+ configuration.add("bar.baz", "bazValue");
+ final IsisConfiguration subset = configuration.createSubset("foo");
+ assertThat(subset.getString("foz"), is("fozValue"));
+ assertThat(subset.getString("faz"), is("fazValue"));
+
+ final Iterator<String> iterator = subset.iterator();
+ assertThat(iterator.hasNext(), is(true));
+ iterator.next();
+ assertThat(iterator.hasNext(), is(true));
+ iterator.next();
+ assertThat(iterator.hasNext(), is(false));
+ }
+
+}
Propchange: incubator/isis/trunk/framework/core/commons/src/test/java/org/apache/isis/core/commons/config/IsisConfigurationDefaultTest_createSubset.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-applib/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-applib/pom.xml?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-applib/pom.xml (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-applib/pom.xml Wed May 30 07:33:50 2012
@@ -39,11 +39,6 @@
<dependencies>
<dependency>
- <groupId>org.apache.isis</groupId>
- <artifactId>applib</artifactId>
- </dependency>
-
- <dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
</dependency>
Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/IsisLifecycleListener.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/IsisLifecycleListener.java?rev=1344132&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/IsisLifecycleListener.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/IsisLifecycleListener.java Wed May 30 07:33:50 2012
@@ -0,0 +1,56 @@
+package org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnitUtil;
+
+import org.apache.openjpa.event.AbstractLifecycleListener;
+import org.apache.openjpa.event.LifecycleEvent;
+
+import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
+import org.apache.isis.core.metamodel.adapter.oid.RootOid;
+import org.apache.isis.core.metamodel.facets.object.callbacks.CallbackUtils;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistedCallbackFacet;
+import org.apache.isis.core.metamodel.facets.object.callbacks.PersistingCallbackFacet;
+import org.apache.isis.runtimes.dflt.runtime.persistence.adaptermanager.AdapterManagerExtended;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.OidGenerator;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSession;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.PersistenceSessionHydrator;
+
+public class IsisLifecycleListener extends AbstractLifecycleListener {
+
+ @Override
+ public void afterPersist(LifecycleEvent event) {
+ final Object pojo = event.getSource();
+
+
+ // TODO: see NakedInsertPostEventListener, since there is much more to be done here..
+
+ final ObjectAdapter adapter = getAdapterManager().adapterFor(pojo);
+
+ CallbackUtils.callCallback(adapter, PersistedCallbackFacet.class);
+ }
+
+ protected AdapterManagerExtended getAdapterManager() {
+ return getPersistenceSession().getAdapterManager();
+ }
+
+ @Override
+ public void afterLoad(LifecycleEvent event) {
+ final Object pojo = event.getSource();
+
+ final OidGenerator oidGenerator = getOidGenerator();
+ final RootOid oid = oidGenerator.createPersistent(pojo, null);
+
+ PersistenceSessionHydrator hydrator = getPersistenceSession();
+ hydrator.recreateAdapter(oid, pojo);
+ }
+
+ protected OidGenerator getOidGenerator() {
+ return getPersistenceSession().getOidGenerator();
+ }
+
+ protected PersistenceSession getPersistenceSession() {
+ return IsisContext.getPersistenceSession();
+ }
+}
Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/IsisLifecycleListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstaller.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstaller.java?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstaller.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstaller.java Wed May 30 07:33:50 2012
@@ -9,6 +9,8 @@ import javax.persistence.EntityManagerFa
import com.google.common.collect.Maps;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
+
import org.apache.isis.core.commons.components.Installer;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.metamodel.adapter.ObjectAdapterFactory;
@@ -18,11 +20,14 @@ import org.apache.isis.extensions.jpa.me
import org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.JpaNamedQueryFacet;
import org.apache.isis.extensions.jpa.metamodel.facets.object.namedquery.NamedQuery;
import org.apache.isis.runtimes.dflt.bytecode.identity.objectfactory.ObjectFactoryBasic;
+import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.spi.OpenJpaIdentifierGenerator;
+import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.spi.OpenJpaSimplePersistAlgorithm;
import org.apache.isis.runtimes.dflt.runtime.installerregistry.installerapi.PersistenceMechanismInstallerAbstract;
import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStore;
import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.algorithm.PersistAlgorithm;
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
import org.apache.isis.runtimes.dflt.runtime.system.persistence.AdapterManager;
+import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
import org.apache.isis.runtimes.dflt.runtime.system.persistence.ObjectFactory;
/**
@@ -52,28 +57,44 @@ public class OpenJpaPersistenceMechanism
private EntityManagerFactory entityManagerFactory = null;
private Map<String, NamedQuery> namedQueryByName = null;
+ private OpenJpaIdentifierGenerator identifierGenerator;
+
public OpenJpaPersistenceMechanismInstaller() {
super(NAME);
}
@Override
protected ObjectStore createObjectStore(IsisConfiguration configuration, ObjectAdapterFactory adapterFactory, AdapterManager adapterManager) {
- if(entityManagerFactory == null) {
-
- final IsisConfiguration openJpaConfig = configuration.createSubset("isis.persistor.openjpa.impl");
-
- final Map<String, String> props = openJpaConfig.asMap();
- final String typeList = entityTypeList();
- props.put("openjpa.MetaDataFactory", "org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory(types=" + typeList + ")");
-
- entityManagerFactory = javax.persistence.Persistence.createEntityManagerFactory(null, props);
-
- namedQueryByName = Collections.unmodifiableMap(catalogNamedQueries());
- }
+ createEntityManagerFactoryIfRequired(configuration);
final OpenJpaObjectStore objectStore = new OpenJpaObjectStore(configuration, adapterFactory, adapterManager, entityManagerFactory, namedQueryByName);
return objectStore;
}
+ private void createEntityManagerFactoryIfRequired(IsisConfiguration configuration) {
+ if(entityManagerFactory != null) {
+ return;
+ }
+
+ final IsisConfiguration openJpaConfig = configuration.createSubset("isis.persistor.openjpa.impl");
+ final Map<String, String> props = openJpaConfig.asMap();
+
+ final String typeList = entityTypeList();
+ props.put("openjpa.MetaDataFactory", "org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory(types=" + typeList + ")");
+
+ entityManagerFactory = javax.persistence.Persistence.createEntityManagerFactory(null, props);
+
+ OpenJPAEntityManagerFactorySPI emfSpi = (OpenJPAEntityManagerFactorySPI) entityManagerFactory;
+ emfSpi.addLifecycleListener(new IsisLifecycleListener(), (Class[])null);
+
+ namedQueryByName = Collections.unmodifiableMap(catalogNamedQueries());
+ }
+
+ @Override
+ protected IdentifierGenerator createIdentifierGenerator(IsisConfiguration configuration) {
+ identifierGenerator = new OpenJpaIdentifierGenerator();
+ return identifierGenerator;
+ }
+
/**
* "org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory(types=org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.fixtures.JpaPrimitiveValuedEntity;)"
*/
Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/facets/RemoveOpenJpaEnhancementTypesFacetFactory.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/facets/RemoveOpenJpaEnhancementTypesFacetFactory.java?rev=1344132&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/facets/RemoveOpenJpaEnhancementTypesFacetFactory.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/facets/RemoveOpenJpaEnhancementTypesFacetFactory.java Wed May 30 07:33:50 2012
@@ -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.runtimes.dflt.objectstores.jpa.openjpa.metamodel.facets;
+
+import org.apache.openjpa.enhance.PersistenceCapable;
+
+import org.apache.isis.core.progmodel.facets.object.ignore.javalang.AbstractRemoveMethodsFacetFactory;
+
+/**
+ * Removes all methods inherited from {@link Object}.
+ */
+public class RemoveOpenJpaEnhancementTypesFacetFactory extends AbstractRemoveMethodsFacetFactory {
+
+ public RemoveOpenJpaEnhancementTypesFacetFactory() {
+ super(PersistenceCapable.class);
+ }
+
+}
Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/facets/RemoveOpenJpaEnhancementTypesFacetFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/progmodelfacets/OpenJpaProgrammingModelFacets.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/progmodelfacets/OpenJpaProgrammingModelFacets.java?rev=1344132&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/progmodelfacets/OpenJpaProgrammingModelFacets.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/progmodelfacets/OpenJpaProgrammingModelFacets.java Wed May 30 07:33:50 2012
@@ -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.runtimes.dflt.objectstores.jpa.openjpa.metamodel.specloader.progmodelfacets;
+
+
+import org.apache.isis.extensions.jpa.metamodel.specloader.progmodelfacets.JpaProgrammingModelFacets;
+import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
+import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.metamodel.facets.RemoveOpenJpaEnhancementTypesFacetFactory;
+
+/**
+ * As per the {@link ProgrammingModelFacetsJava5 Java 5 default programming
+ * model}, but also
+ * includes support for JPA.
+ * <p>
+ * Intended to be used by the {@link JpaJavaReflectorInstaller}, which
+ * additionally sets up other required components needed for JPA support.
+ */
+public class OpenJpaProgrammingModelFacets extends JpaProgrammingModelFacets {
+
+ public OpenJpaProgrammingModelFacets() {
+ addFactory(RemoveOpenJpaEnhancementTypesFacetFactory.class);
+ }
+
+}
+
+
+// Copyright (c) Naked Objects Group Ltd.
Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/metamodel/specloader/progmodelfacets/OpenJpaProgrammingModelFacets.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryFindAllInstancesProcessor.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryFindAllInstancesProcessor.java?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryFindAllInstancesProcessor.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryFindAllInstancesProcessor.java Wed May 30 07:33:50 2012
@@ -27,7 +27,8 @@ public class PersistenceQueryFindAllInst
LOG.debug("getInstances: class=" + specification.getFullIdentifier());
}
final Query query = QueryUtil.createQuery(getEntityManager(), "o", null, specification, null);
- return loadAdapters(specification, query.getResultList());
+ final List<?> pojos = query.getResultList();
+ return loadAdapters(specification, pojos);
}
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryProcessorAbstract.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryProcessorAbstract.java?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryProcessorAbstract.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/queries/PersistenceQueryProcessorAbstract.java Wed May 30 07:33:50 2012
@@ -9,6 +9,8 @@ import javax.persistence.metamodel.Metam
import com.google.common.collect.Lists;
+import org.apache.isis.core.commons.ensure.Assert;
+import org.apache.isis.core.commons.ensure.Ensure;
import org.apache.isis.core.commons.factory.InstanceUtil;
import org.apache.isis.core.commons.lang.CastUtils;
import org.apache.isis.core.metamodel.adapter.ObjectAdapter;
@@ -49,12 +51,9 @@ public abstract class PersistenceQueryPr
final ObjectSpecification specification, final List<?> pojos) {
final List<ObjectAdapter> adapters = Lists.newArrayList();
for (final Object pojo : pojos) {
- // REVIEW: cannot just load adapter for object - if Isis
- // 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 JPA session to get an Oid to
- // do a lookup in that case
- adapters.add( adapterManager.getAdapterFor(pojo) );
+ ObjectAdapter adapter = adapterManager.getAdapterFor(pojo);
+ Assert.assertNotNull(adapter);
+ adapters.add( adapter );
}
return adapters;
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaIdentifierGenerator.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaIdentifierGenerator.java?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaIdentifierGenerator.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaIdentifierGenerator.java Wed May 30 07:33:50 2012
@@ -2,6 +2,9 @@ package org.apache.isis.runtimes.dflt.ob
import java.util.UUID;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.PersistenceUnitUtil;
+
import org.apache.log4j.Logger;
import org.apache.isis.core.commons.debug.DebugBuilder;
@@ -10,16 +13,25 @@ import org.apache.isis.core.metamodel.ad
import org.apache.isis.core.metamodel.adapter.map.AdapterMapAware;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.facets.accessor.PropertyOrCollectionAccessorFacet;
+import org.apache.isis.core.metamodel.facets.object.encodeable.EncodableFacet;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.core.metamodel.spec.SpecificationLookup;
+import org.apache.isis.core.metamodel.spec.SpecificationLookupAware;
import org.apache.isis.core.metamodel.spec.feature.OneToOneAssociation;
import org.apache.isis.extensions.jpa.metamodel.util.JpaPropertyUtils;
+import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.OpenJpaObjectStore;
+import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.OpenJpaPersistenceMechanismInstaller;
+import org.apache.isis.runtimes.dflt.runtime.persistence.objectstore.ObjectStorePersistence;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
import org.apache.isis.runtimes.dflt.runtime.system.persistence.IdentifierGenerator;
-public class OpenJpaIdentifierGenerator implements IdentifierGenerator, AdapterMapAware {
+public class OpenJpaIdentifierGenerator implements IdentifierGenerator, AdapterMapAware, SpecificationLookupAware {
@SuppressWarnings("unused")
private static final Logger LOG = Logger.getLogger(OpenJpaIdentifierGenerator.class);
private AdapterMap adapterMap;
+ private SpecificationLookup specificationLookup;
// //////////////////////////////////////////////////////////////
@@ -40,17 +52,28 @@ public class OpenJpaIdentifierGenerator
@Override
public String createPersistentIdentifierFor(ObjectSpecId objectSpecId, Object pojo, RootOid transientRootOid) {
- final ObjectAdapter adapter = adapterMap.adapterFor(pojo);
- final OneToOneAssociation idPropertyFor = JpaPropertyUtils.getIdPropertyFor(adapter.getSpecification());
- if (idPropertyFor == null) {
- throw new IllegalStateException("cannot find id property for pojo");
+ final Object identifier = getPersistenceUnitUtil().getIdentifier(pojo);
+ if(identifier == null) {
+ // is a service
+ return "1";
}
- final PropertyOrCollectionAccessorFacet facet = idPropertyFor.getFacet(PropertyOrCollectionAccessorFacet.class);
- final Object propertyValue = facet.getProperty(adapter);
- return propertyValue.toString();
+
+ // was assuming that the identifier would be an object that we have visibility to
+ // but instead, is an internal OpenJPA class (eg IntId)
+ // so, the following code doesn't work
+// final ObjectAdapter identifierAdapter = adapterMap.adapterFor(identifier);
+// final EncodableFacet encodableFacet = identifierAdapter.getSpecification().getFacet(EncodableFacet.class);
+// final String identifierAsString = encodableFacet.toEncodedString(identifierAdapter);
+//
+// return identifierAsString;
+
+
+ // for now, just using toString(). Suspect will need to review this
+ return identifier.toString();
}
+
// //////////////////////////////////////////////////////////////
// Debugging
// //////////////////////////////////////////////////////////////
@@ -77,5 +100,28 @@ public class OpenJpaIdentifierGenerator
}
+ @Override
+ public void setSpecificationLookup(SpecificationLookup specificationLookup) {
+ this.specificationLookup = specificationLookup;
+ }
+
+
+ // //////////////////////////////////////////////////////////////
+ // Dependencies (from context)
+ // //////////////////////////////////////////////////////////////
+
+
+ protected PersistenceUnitUtil getPersistenceUnitUtil() {
+ final OpenJpaObjectStore objectStore = getObjectStore();
+ return objectStore.getEntityManager().getEntityManagerFactory().getPersistenceUnitUtil();
+ }
+
+
+ protected OpenJpaObjectStore getObjectStore() {
+ return (OpenJpaObjectStore) IsisContext.getPersistenceSession().getObjectStore();
+ }
+
+
+
}
// Copyright (c) Naked Objects Group Ltd.
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaSimplePersistAlgorithm.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaSimplePersistAlgorithm.java?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaSimplePersistAlgorithm.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/main/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/spi/OpenJpaSimplePersistAlgorithm.java Wed May 30 07:33:50 2012
@@ -44,8 +44,6 @@ public class OpenJpaSimplePersistAlgorit
if (LOG.isInfoEnabled()) {
LOG.info("persist " + adapter);
}
- // NakedObjects.getObjectLoader().madePersistent(object);
- // Don't do here - allow EventListener to propogate persistent state
CallbackUtils.callCallback(adapter, PersistingCallbackFacet.class);
toPersistObjectSet.addPersistedObject(adapter);
}
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstallerTest_openAndClose.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstallerTest_openAndClose.java?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstallerTest_openAndClose.java (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/OpenJpaPersistenceMechanismInstallerTest_openAndClose.java Wed May 30 07:33:50 2012
@@ -12,7 +12,6 @@ import java.sql.Statement;
import java.util.List;
import java.util.Properties;
-import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -24,53 +23,27 @@ import org.apache.isis.core.metamodel.ad
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
import org.apache.isis.extensions.jpa.metamodel.specloader.progmodelfacets.JpaProgrammingModelFacets;
import org.apache.isis.extensions.jpa.metamodel.specloader.validator.JpaMetaModelValidator;
-import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.fixtures.JpaPrimitiveValuedEntity;
-import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.fixtures.JpaPrimitiveValuedEntityRepository;
+import org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa.metamodel.specloader.progmodelfacets.OpenJpaProgrammingModelFacets;
import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
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 OpenJpaPersistenceMechanismInstallerTest_openAndClose {
- private JpaPrimitiveValuedEntityRepository repo = new JpaPrimitiveValuedEntityRepository();
+ private PrimitiveValuedEntityRepository repo = new PrimitiveValuedEntityRepository();
@Rule
public IsisSystemWithFixtures iswf = IsisSystemWithFixtures.builder()
- .with(configuration())
- .with(new JpaProgrammingModelFacets())
+ .with(Utils.configurationForOpenJpaOverHsqlDb())
+ .with(Utils.listenerToDeleteFrom("PRIMITIVEVALUEDENTITY"))
+ .with(new OpenJpaProgrammingModelFacets())
.with(new JpaMetaModelValidator())
.with(new OpenJpaPersistenceMechanismInstaller())
.withServices(repo)
- .with(hsqldbListener())
.build()
;
- private static IsisSystemWithFixtures.Listener hsqldbListener() {
- return new IsisSystemWithFixtures.ListenerAdapter(){
-
- @Override
- public void postSetupSystem(boolean firstTime) throws Exception {
- final OpenJpaObjectStore objectStore = (OpenJpaObjectStore) IsisContext.getPersistenceSession().getObjectStore();
- Connection connection = objectStore.getConnection();
- Statement statement = connection.createStatement();
- statement.executeUpdate("DELETE FROM JPAPRIMITIVEVALUEDENTITY");
- }
- };
- }
-
- private static IsisConfiguration configuration() {
- final IsisConfigurationDefault configuration = new IsisConfigurationDefault();
- Properties props = new Properties();
- props.put("isis.persistor.openjpa.impl.openjpa.jdbc.SynchronizeMappings", "buildSchema");
- props.put("isis.persistor.openjpa.impl.openjpa.ConnectionURL", "jdbc:hsqldb:mem:test");
- props.put("isis.persistor.openjpa.impl.openjpa.ConnectionDriverName", "org.hsqldb.jdbcDriver");
- props.put("isis.persistor.openjpa.impl.openjpa.ConnectionUserName", "sa");
- props.put("isis.persistor.openjpa.impl.openjpa.ConnectionPassword", "");
- props.put("isis.persistor.openjpa.impl.openjpa.Log", "DefaultLevel=ERROR, Tool=INFO");
- props.put("isis.persistor.openjpa.impl.openjpa.RuntimeUnenhancedClasses", "supported"); // in production, should always pre-enhance using the maven openjpa plugin
-
- configuration.add(props);
- return configuration;
- }
@Test
public void servicesBootstrapped() {
@@ -81,7 +54,7 @@ public class OpenJpaPersistenceMechanism
final ObjectAdapter serviceAdapter = IsisContext.getPersistenceSession().getAdapterManager().getAdapterFor(repo);
assertThat(serviceAdapter, is(not(nullValue())));
- assertThat(serviceAdapter.getOid(), is(equalTo((Oid)RootOidDefault.create(ObjectSpecId.of("JpaPrimitiveValuedEntities"), "1"))));
+ assertThat(serviceAdapter.getOid(), is(equalTo((Oid)RootOidDefault.create(ObjectSpecId.of("PrimitiveValuedEntities"), "1"))));
}
@Test
@@ -93,7 +66,7 @@ public class OpenJpaPersistenceMechanism
@Test
public void emptyList() {
iswf.beginTran();
- final List<JpaPrimitiveValuedEntity> list = repo.list();
+ final List<PrimitiveValuedEntity> list = repo.list();
assertThat(list.size(), is(0));
iswf.commitTran();
}
@@ -101,14 +74,24 @@ public class OpenJpaPersistenceMechanism
@Test
public void persistThenRetrieve() throws Exception {
iswf.beginTran();
- final JpaPrimitiveValuedEntity entity = repo.newEntity();
+ PrimitiveValuedEntity entity = repo.newEntity();
+ entity.setId(1);
+ entity = repo.newEntity();
+ entity.setId(2);
iswf.commitTran();
iswf.bounceSystem();
iswf.beginTran();
- final List<JpaPrimitiveValuedEntity> list = repo.list();
- assertThat(list.size(), is(1));
+ final List<PrimitiveValuedEntity> list = repo.list();
+ assertThat(list.size(), is(2));
+
+ ObjectAdapter adapter = iswf.adapterFor(list.get(0));
+ assertThat(adapter.getOid().enString(), is("PRMV:1"));
+
+ adapter = iswf.adapterFor(list.get(1));
+ assertThat(adapter.getOid().enString(), is("PRMV:2"));
+
iswf.commitTran();
}
Added: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/Utils.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/Utils.java?rev=1344132&view=auto
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/Utils.java (added)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/Utils.java Wed May 30 07:33:50 2012
@@ -0,0 +1,51 @@
+package org.apache.isis.runtimes.dflt.objectstores.jpa.openjpa;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+import org.apache.isis.core.commons.config.IsisConfiguration;
+import org.apache.isis.core.commons.config.IsisConfigurationDefault;
+import org.apache.isis.runtimes.dflt.runtime.system.context.IsisContext;
+import org.apache.isis.runtimes.dflt.testsupport.IsisSystemWithFixtures;
+
+public class Utils {
+
+ private Utils(){}
+
+ public static IsisSystemWithFixtures.Listener listenerToDeleteFrom(final String... tables) {
+ return new IsisSystemWithFixtures.ListenerAdapter(){
+
+ @Override
+ public void postSetupSystem(boolean firstTime) throws Exception {
+ final Statement statement = createStatement();
+ for(String table: tables) {
+ statement.executeUpdate("DELETE FROM " + table);
+ }
+ }
+
+ private Statement createStatement() throws SQLException {
+ final OpenJpaObjectStore objectStore = (OpenJpaObjectStore) IsisContext.getPersistenceSession().getObjectStore();
+ Connection connection = objectStore.getConnection();
+ return connection.createStatement();
+ }
+ };
+ }
+
+ public static IsisConfiguration configurationForOpenJpaOverHsqlDb() {
+ final IsisConfigurationDefault configuration = new IsisConfigurationDefault();
+ Properties props = new Properties();
+ props.put("isis.persistor.openjpa.impl.openjpa.jdbc.SynchronizeMappings", "buildSchema");
+ //props.put("isis.persistor.openjpa.impl.openjpa.ConnectionURL", "jdbc:hsqldb:file:hsql-db/test;hsqldb.write_delay=false;shutdown=true");
+ props.put("isis.persistor.openjpa.impl.openjpa.ConnectionURL", "jdbc:hsqldb:mem:test");
+ props.put("isis.persistor.openjpa.impl.openjpa.ConnectionDriverName", "org.hsqldb.jdbcDriver");
+ props.put("isis.persistor.openjpa.impl.openjpa.ConnectionUserName", "sa");
+ props.put("isis.persistor.openjpa.impl.openjpa.ConnectionPassword", "");
+ props.put("isis.persistor.openjpa.impl.openjpa.Log", "DefaultLevel=ERROR, Tool=INFO");
+ props.put("isis.persistor.openjpa.impl.openjpa.RuntimeUnenhancedClasses", "supported"); // in production, should always pre-enhance using the maven openjpa plugin
+ configuration.add(props);
+ return configuration;
+ }
+
+}
Propchange: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/jpa-openjpa/src/test/java/org/apache/isis/runtimes/dflt/objectstores/jpa/openjpa/Utils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/pom.xml?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/pom.xml (original)
+++ incubator/isis/trunk/framework/runtimes/dflt/objectstores/jpa/pom.xml Wed May 30 07:33:50 2012
@@ -49,9 +49,7 @@
<modules>
<module>jpa-applib</module>
<module>jpa-metamodel</module>
- <!--
<module>jpa-openjpa</module>
- -->
</modules>
<build>
Modified: incubator/isis/trunk/framework/tck/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/tck/pom.xml?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/tck/pom.xml (original)
+++ incubator/isis/trunk/framework/tck/pom.xml Wed May 30 07:33:50 2012
@@ -329,6 +329,24 @@
<version>0.3.1-incubating-SNAPSHOT</version>
</dependency>
+ <!-- isis: runtimes-dflt: objectstores: jpa/openjpa -->
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+ <artifactId>jpa-applib</artifactId>
+ <version>0.3.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+ <artifactId>jpa-metamodel</artifactId>
+ <version>0.3.1-incubating-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+ <artifactId>jpa-openjpa</artifactId>
+ <version>0.3.1-incubating-SNAPSHOT</version>
+ </dependency>
+
+
<!-- isis: runtimes-dflt: profilestores: dflt -->
<dependency>
<groupId>org.apache.isis.runtimes.dflt.profilestores</groupId>
Modified: incubator/isis/trunk/framework/tck/tck-dom/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/tck/tck-dom/pom.xml?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/tck/tck-dom/pom.xml (original)
+++ incubator/isis/trunk/framework/tck/tck-dom/pom.xml Wed May 30 07:33:50 2012
@@ -33,6 +33,11 @@
<groupId>org.apache.isis</groupId>
<artifactId>applib</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.isis.runtimes.dflt.objectstores</groupId>
+ <artifactId>jpa-applib</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.isis.viewer</groupId>
Modified: incubator/isis/trunk/framework/tck/tck-dom/src/main/java/org/apache/isis/tck/dom/scalars/PrimitiveValuedEntity.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/tck/tck-dom/src/main/java/org/apache/isis/tck/dom/scalars/PrimitiveValuedEntity.java?rev=1344132&r1=1344131&r2=1344132&view=diff
==============================================================================
--- incubator/isis/trunk/framework/tck/tck-dom/src/main/java/org/apache/isis/tck/dom/scalars/PrimitiveValuedEntity.java (original)
+++ incubator/isis/trunk/framework/tck/tck-dom/src/main/java/org/apache/isis/tck/dom/scalars/PrimitiveValuedEntity.java Wed May 30 07:33:50 2012
@@ -19,13 +19,32 @@
package org.apache.isis.tck.dom.scalars;
+import javax.persistence.DiscriminatorValue;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
import org.apache.isis.applib.AbstractDomainObject;
import org.apache.isis.applib.annotation.MemberOrder;
import org.apache.isis.applib.annotation.ObjectType;
+@Entity // for openjpa object store
+@DiscriminatorValue("PRMV") // for openjpa object store
@ObjectType("PRMV")
public class PrimitiveValuedEntity extends AbstractDomainObject {
+ // {{ Id (Integer)
+ private Integer id;
+
+ @Id // for openjpa object store
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(final Integer id) {
+ this.id = id;
+ }
+ // }}
+
// {{ Title
public String title() {
return null;