Skip to content

If a user has a PK class using javax.jdo.XXXIdentity as part of a compound id, this fails on enhancement #3

@andyjefferson

Description

@andyjefferson

Since we use the DN-internal single field id PK classes now, this is failing a check at
org.datanucleus.metadata.AbstractClassMetaData.validateObjectIdClass

The simple workaround is to specify DN-specific PK fields, or provide an objectIdClass for the object that makes up the PK.

The stack trace with v4.0.3 is as follows

Class "mydomain.model.CompoundTarget" has been specified with an object-id class mydomain.model.CompoundTarget$Id which has a field source. The field mydomain.model.CompoundTarget$Id.source has type javax.jdo.identity.LongIdentity but should be org.datanucleus.identity.LongId. All non static fields of an objectId class must include the names of the primary key fields in the JDO class, and the types of the corresponding fields must be identical.
org.datanucleus.metadata.InvalidPrimaryKeyException: Class "mydomain.model.CompoundTarget" has been specified with an object-id class mydomain.model.CompoundTarget$Id which has a field source. The field mydomain.model.CompoundTarget$Id.source has type javax.jdo.identity.LongIdentity but should be org.datanucleus.identity.LongId. All non static fields of an objectId class must include the names of the primary key fields in the JDO class, and the types of the corresponding fields must be identical.
at org.datanucleus.api.jdo.JDOAdapter.processPrimaryKeyClass(JDOAdapter.java:551)
at org.datanucleus.api.jdo.JDOAdapter.isValidPrimaryKeyClass(JDOAdapter.java:464)
at org.datanucleus.metadata.AbstractClassMetaData.validateObjectIdClass(AbstractClassMetaData.java:1442)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions