Hibernate: bug when mapping a reference to an alternative/natural key column of a sub table?

Answering my own question: It's not a bug in It's the JPA 2.0 spec that prohibits references to non-PK columns when used as a derived identifier at the same time. See my other answer here for more details: Why is this JPA 2.0 mapping giving me an error in Eclipse/JBoss Tools? Note it's also causing a mapping exception with EclipseLink (you just get a more meaningful stack trace): Exception Description: The derived composite primary key attribute country of type java.lang.

String from tld.geoareas.model. ZipId should be of the same type as its parent id field from tld.geoareas.model.Country. That is, it should be of type java.lang.Integer.At org.eclipse.persistence.exceptions.

ValidationException. InvalidDerivedCompositePKAttribute(ValidationException. Java:1134) at org.eclipse.persistence.internal.jpa.metadata.

MetadataDescriptor. ValidateDerivedPKClassId(MetadataDescriptor. Java:1817) at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ObjectAccessor.

ProcessId(ObjectAccessor. Java:450) at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.ObjectAccessor. ProcessOwningMappingKeys(ObjectAccessor.

Java:659) at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings. ManyToOneAccessor. Process(ManyToOneAccessor.

Java:110) at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor. ProcessDerivedId(ClassAccessor. Java:1409) at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.

ProcessDerivedId(EntityAccessor. Java:823) at org.eclipse.persistence.internal.jpa.metadata.MetadataProject. ProcessAccessorsWithDerivedIDs(MetadataProject.

Java:1294) at org.eclipse.persistence.internal.jpa.metadata.MetadataProject. ProcessStage3(MetadataProject. Java:1560) at org.eclipse.persistence.internal.jpa.metadata.

MetadataProcessor. ProcessORMMetadata(MetadataProcessor. Java:484) at org.eclipse.persistence.internal.jpa.deployment.

PersistenceUnitProcessor. ProcessORMetadata(PersistenceUnitProcessor. Java:453) at org.eclipse.persistence.internal.jpa.

EntityManagerSetupImpl. Predeploy(EntityManagerSetupImpl. Java:1080) ... 6 more.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions