Hi Andy, > On Jul 20, 2017, at 11:40 PM, Andy Jefferson <a...@datanucleus.org> wrote: > > Hi Craig, > >> It looks like the DN enhancer recognizes the annotation as a >> persistence-capable class because it is annotated with PersistenceCapable >> but doesn't recognize it as an annotation that should not be enhanced. > > Quite probably. I've only been enhancing through a persistence.xml file > recently, which explicitly specifies the classes to be enhanced so never hit > that one. > >> I looked at the code and think that perhaps a patch like this would fix it. >> org.datanucleus.enhancer.ClassEnhancerImpl around line 298 after the cls >> object is obtained: >> >> if (cls.isAnnotation()) >> { >> return false; >> } >> >> Other possible solutions: move the composite annotations out of the package >> into a sibling package. This probably works but is awkward. > > No, let's just fix the code rather than imposing the user has to do something.
I agree. That didn't work anyway (see subsequent message for details). > > Instead of doing your proposed fix, I put a couple of checks in further > upstream, where it reads annotations for a class to check if it is has > metadata. > > See https://github.com/datanucleus/datanucleus-core/commit/ > f048a37494066b46545a1849d536104dc149950d > > A simple test with that fix, explicitly adding the meta-annotation class to > persistence.xml results in a log message that the class has no metadata and > is > ignored. > > That should be in current DN nightly builds, so give it a try and see if it > catches your situation. I updated the pom.xml to 5.1.1-SNAPSHOT and the enhancer step worked but many tck tests fail. [1] Thanks, Craig 09:58:35,295 (main) INFO [DataNucleus.JDO] - Exception thrown Class "org.apache.jdo.tck.pc.companyAnnotatedFC.DatastoreIdDiscriminatorClassNameInheritanceSuperclass" has been specified with an inheritance strategy of "superclass-table", yet no superclass exists or none exists with its own table! org.datanucleus.metadata.InvalidClassMetaDataException: Class "org.apache.jdo.tck.pc.companyAnnotatedFC.DatastoreIdDiscriminatorClassNameInheritanceSuperclass" has been specified with an inheritance strategy of "superclass-table", yet no superclass exists or none exists with its own table! at org.datanucleus.metadata.AbstractClassMetaData.validateUserInputForInheritanceMetaData(AbstractClassMetaData.java:874) at org.datanucleus.metadata.InterfaceMetaData.populate(InterfaceMetaData.java:120) at org.datanucleus.metadata.MetaDataManagerImpl$1.run(MetaDataManagerImpl.java:2926) at java.security.AccessController.doPrivileged(Native Method) at org.datanucleus.metadata.MetaDataManagerImpl.populateAbstractClassMetaData(MetaDataManagerImpl.java:2920) at org.datanucleus.metadata.MetaDataManagerImpl.populateFileMetaData(MetaDataManagerImpl.java:2724) at org.datanucleus.metadata.MetaDataManagerImpl.initialiseFileMetaDataForUse(MetaDataManagerImpl.java:1365) at org.datanucleus.metadata.MetaDataManagerImpl.loadClasses(MetaDataManagerImpl.java:645) at org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:672) at org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:500) at org.datanucleus.api.jdo.JDOEnhancer.enhance(JDOEnhancer.java:125) at org.apache.jdo.exectck.Enhance.execute(Enhance.java:288) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) *> Running tests for runonce.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for instancecallbacks.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for jdohelper.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for pm.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for pmf.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for detach.conf with datastoreidentity on 'derby' mapping=8 ... success *> Running tests for embeddedInheritance.conf with datastoreidentity on 'derby' mapping=12 ... success *> Running tests for enhancement.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for extents.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for fetchplan.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for fetchgroup.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for lifecycle.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for models.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for models1.conf with datastoreidentity on 'derby' mapping=1 ... success *> Running tests for query.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for jdoql.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for jdoql1.conf with datastoreidentity on 'derby' mapping=1 ... success *> Running tests for transactions.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyNoRelationships.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyEmbedded.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for company1-1Relationships.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for company1-MRelationships.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyM-MRelationships.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAllRelationships.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyMapWithoutJoin.conf with datastoreidentity on 'derby' mapping=9 ... success *> Running tests for companyListWithoutJoin.conf with datastoreidentity on 'derby' mapping=10 ... success *> Running tests for companyPMClass.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyPMInterface.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotated1-1RelationshipsFCPM.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotated1-MRelationshipsFCPM.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedAllRelationshipsFCConcrete.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedAllRelationshipsFCPM.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedAllRelationshipsPCConcrete.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsJPAConcrete.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsJPAPM.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsPCPM.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsPIPM.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedEmbeddedFCPM.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedM-MRelationshipsFCConcrete.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedM-MRelationshipsFCPM.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedNoRelationshipsFCConcrete.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedNoRelationshipsFCPM.conf with datastoreidentity on 'derby' mapping= ... FAIL *> Running tests for companyAnnotatedNoRelationshipsPCConcrete.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedEmbeddedJPAConcrete.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedEmbeddedJPAPM.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedNoRelationshipsPCPM.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedNoRelationshipsPIPM.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for companyOverrideAnnotatedAllRelationshipsFCPM.conf with datastoreidentity on 'derby' mapping=11 ... FAIL *> Running tests for inheritance1.conf with datastoreidentity on 'derby' mapping=1 ... success *> Running tests for inheritance2.conf with datastoreidentity on 'derby' mapping=2 ... success *> Running tests for inheritance3.conf with datastoreidentity on 'derby' mapping=3 ... success *> Running tests for inheritance4.conf with datastoreidentity on 'derby' mapping=4 ... success *> Running tests for relationshipAllRelationships.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for relationshipNoRelationships.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for schemaAttributeClass.conf with datastoreidentity on 'derby' mapping=7 ... success *> Running tests for schemaAttributeOrm.conf with datastoreidentity on 'derby' mapping=5 ... success *> Running tests for schemaAttributePackage.conf with datastoreidentity on 'derby' mapping=6 ... success *> Running tests for compoundIdentity.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for throwOnUnknownStandardProperties.conf with datastoreidentity on 'derby' mapping= ... success *> Running tests for instancecallbacks.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for jdohelper.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for pm.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for pmf.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for detach.conf with applicationidentity on 'derby' mapping=8 ... success *> Running tests for embeddedInheritance.conf with applicationidentity on 'derby' mapping=12 ... success *> Running tests for enhancement.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for extents.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for fetchplan.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for fetchgroup.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for lifecycle.conf with applicationidentity on 'derby' mapping= ... FAIL *> Running tests for models.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for models1.conf with applicationidentity on 'derby' mapping=1 ... success *> Running tests for query.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for jdoql.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for jdoql1.conf with applicationidentity on 'derby' mapping=1 ... success *> Running tests for transactions.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyNoRelationships.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyEmbedded.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for company1-1Relationships.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for company1-MRelationships.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyM-MRelationships.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAllRelationships.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyMapWithoutJoin.conf with applicationidentity on 'derby' mapping=9 ... success *> Running tests for companyListWithoutJoin.conf with applicationidentity on 'derby' mapping=10 ... success *> Running tests for companyPMClass.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyPMInterface.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotated1-1RelationshipsFCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotated1-MRelationshipsFCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsFCConcrete.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsFCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsPCConcrete.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsJPAConcrete.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsJPAPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsPCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedAllRelationshipsPIPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedEmbeddedFCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedM-MRelationshipsFCConcrete.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedM-MRelationshipsFCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedNoRelationshipsFCConcrete.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedNoRelationshipsFCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedNoRelationshipsPCConcrete.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedEmbeddedJPAConcrete.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedEmbeddedJPAPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedNoRelationshipsPCPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyAnnotatedNoRelationshipsPIPM.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for companyOverrideAnnotatedAllRelationshipsFCPM.conf with applicationidentity on 'derby' mapping=11 ... success *> Running tests for inheritance1.conf with applicationidentity on 'derby' mapping=1 ... success *> Running tests for inheritance2.conf with applicationidentity on 'derby' mapping=2 ... success *> Running tests for inheritance3.conf with applicationidentity on 'derby' mapping=3 ... success *> Running tests for inheritance4.conf with applicationidentity on 'derby' mapping=4 ... success *> Running tests for relationshipAllRelationships.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for relationshipNoRelationships.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for schemaAttributeClass.conf with applicationidentity on 'derby' mapping=7 ... success *> Running tests for schemaAttributeOrm.conf with applicationidentity on 'derby' mapping=5 ... success *> Running tests for schemaAttributePackage.conf with applicationidentity on 'derby' mapping=6 ... success *> Running tests for compoundIdentity.conf with applicationidentity on 'derby' mapping= ... success *> Running tests for throwOnUnknownStandardProperties.conf with applicationidentity on 'derby' mapping= ... success > > > > > Regards > -- > Andy > DataNucleus (Web: http://www.datanucleus.org Twitter: @datanucleus) Craig L Russell Secretary, Apache Software Foundation c...@apache.org http://db.apache.org/jdo