Thanks Dan, I'll look at suggesions, but regarding 1, its for my codes tables, where the only property in each extending class is 'name'.
On Thu, Sep 17, 2015 at 5:58 PM, Dan Haywood <[email protected]> wrote: > Not sure, haven't seen this error, and I don't think we use SUBCLASS_TABLE > in Estatio. > > Some thoughts: > > 1. from a modelling perspective, I think this is wrong. Presumably the > idea is that the SimpleNamedEntity factors out the responsibility of all > entities that happen to have a "name" property? However, this sort of > inheritance of implementation is bad practice, IMHO. > > I don't think there's anything wrong with defining an interface and have > other classes implement that interface (similar to the > "CreateTrackingEntity" and "ModifyTrackingEntity" of previous thread), but > the actual implementation should be repeated in the different classes. > > > 2. not withstanding the above, it might be a configuration issue. We use > the configuration property to find all the possible entities, perhaps this > is correctly specified for your app but missing for your integration tests: > > > https://isis.apache.org/guides/rg.html#_rg_runtime_configuring-datanucleus_properties > > > Alternative, the AppManifest approach unifies the configuration for both > the app and integ tests, so you might want to port to using that if not > already. > > > 3. if the above doesn't work, you could also try the old workaround we used > to use before introducing this config property, namely adding a dummy > method to a service might help DN find the class, eg: > > @DomainService(nature=NatureOfService.DOMAIN) > public void DataNucleusWorkaround { > @Hidden public void register(SimpleNamedEntity e) {} > } > > This forces the SimpleNamedEntity to be added to Isis' metamodel, and thus > ends up telling DN about it. > > > ~~~ > HTH > > > Thanks > Dan > > > > > On 17 September 2015 at 08:25, Stephen Cameron <[email protected] > > > wrote: > > > The relevant class is a simple abstract one > > > > package au.com.scds.chats.dom.module.general.names; > > > > import javax.jdo.annotations.Column; > > import javax.jdo.annotations.IdentityType; > > import javax.jdo.annotations.Inheritance; > > import javax.jdo.annotations.InheritanceStrategy; > > import javax.jdo.annotations.PersistenceCapable; > > import javax.jdo.annotations.PrimaryKey; > > > > import au.com.scds.chats.dom.AbstractNamedChatsDomainEntity; > > > > @PersistenceCapable(identityType = IdentityType.APPLICATION) > > @Inheritance(strategy = InheritanceStrategy.SUBCLASS_TABLE) > > public abstract class SimpleNamedEntity { > > > > private String name; > > > > @PrimaryKey > > @Column(allowsNull="false") > > public String getName() { > > return name; > > } > > > > public void setName(String name) { > > this.name = name; > > } > > > > @Override > > public boolean equals(final Object obj) { > > if (obj == null) { > > return false; > > } > > if (obj == this) { > > return true; > > } > > if (!this.getClass().isInstance(obj)) { > > return false; > > } > > return ((SimpleNamedEntity) > obj).getName().equals(this.getName()); > > } > > > > @Override > > public String toString() { > > return this.getClass().getName() + ":" + this.getName(); > > } > > } > > > > On Thu, Sep 17, 2015 at 5:23 PM, Stephen Cameron < > > [email protected] > > > wrote: > > > > > Hi, > > > > > > I am getting an datanucleus exception relating to a missing table when > > > that table as InheritanceStrategy.SUBCLASS_TABLE, so no table is > correct. > > > > > > I don't get the error when running the webapp, only the integtests, so > > > wondering if its something relating to use of wrap()? > > > > > > 17:10:54,412 [Schema Thread-0 DEBUG] An error > occurred > > > while auto-creating schema elements - rolling back > > > Persistent class > > > "au.com.scds.chats.dom.module.general.names.SimpleNamedEntity" has no > > table > > > in the database, but the operation requires it. Please check the > > > specification of the MetaData for this class. > > > org.datanucleus.store.rdbms.exceptions.NoTableManagedException: > > Persistent > > > class "au.com.scds.chats.dom.module.general.names.SimpleNamedEntity" > has > > no > > > table in the database, but the operation requires it. Please check the > > > specification of the MetaData for this class. > > > at > > > > > > org.datanucleus.store.rdbms.RDBMSStoreManager.getDatastoreClass(RDBMSStoreManager.java:698) > > > at > > > > > > org.datanucleus.store.rdbms.table.ClassTable.initializePK(ClassTable.java:1003) > > > at > > > > > > org.datanucleus.store.rdbms.table.ClassTable.preInitialize(ClassTable.java:250) > > > at > > > > > > org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTable(RDBMSStoreManager.java:3194) > > > at > > > > > > org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.addClassTables(RDBMSStoreManager.java:2993) > > > at > > > > > > org.datanucleus.store.rdbms.RDBMSStoreManager$ClassAdder.run(RDBMSStoreManager.java:2872) > > > at > > > > > > org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:119) > > > at > > > > > > org.datanucleus.store.rdbms.RDBMSStoreManager.createSchemaForClasses(RDBMSStoreManager.java:3842) > > > at > > > > > > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusApplicationComponents.createSchema(DataNucleusApplicationComponents.java:196) > > > at > > > > > > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusApplicationComponents.createPmfAndSchemaIfRequired(DataNucleusApplicationComponents.java:155) > > > at > > > > > > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusApplicationComponents.initialize(DataNucleusApplicationComponents.java:110) > > > at > > > > > > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusApplicationComponents.<init>(DataNucleusApplicationComponents.java:103) > > > at > > > > > > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller.createDataNucleusApplicationComponentsIfRequired(DataNucleusPersistenceMechanismInstaller.java:134) > > > at > > > > > > org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller.createObjectStore(DataNucleusPersistenceMechanismInstaller.java:110) > > > at > > > > > > org.apache.isis.core.runtime.system.persistence.PersistenceSessionFactory.createPersistenceSession(PersistenceSessionFactory.java:95) > > > at > > > > > > org.apache.isis.core.runtime.system.session.IsisSessionFactory.openSession(IsisSessionFactory.java:141) > > > at > > > > > > org.apache.isis.core.runtime.system.context.IsisContextStatic.openSessionInstance(IsisContextStatic.java:70) > > > at > > > > > > org.apache.isis.core.runtime.system.context.IsisContext.openSession(IsisContext.java:279) > > > at > > > > > > org.apache.isis.core.runtime.system.IsisSystem.shutdownServices(IsisSystem.java:311) > > > at > > > > > > org.apache.isis.core.runtime.system.IsisSystem.shutdown(IsisSystem.java:300) > > > at > > > > > > org.apache.isis.core.integtestsupport.IsisSystemForTest.shutdown(IsisSystemForTest.java:467) > > > at > > > > > > org.apache.isis.core.integtestsupport.IsisSystemForTest.access$100(IsisSystemForTest.java:74) > > > at > > > > > > org.apache.isis.core.integtestsupport.IsisSystemForTest$Builder$1.run(IsisSystemForTest.java:301) > > > 17:10:54,415 [ObjectReflectorDefault Thread-0 INFO ] shutting down > > > > org.apache.isis.core.metamodel.specloader.ObjectReflectorDefault@6c4f090a > > > > > >
