It’s been a while, but, if I recall correctly, the example is missing/assumes a different attribute being the primary key. E.g.:
With that, the @NaturalId cannot be an @EmbeddedId. Though, it should still be possible to map entities using a (non-primary) embedded composite natural key. I’ve reconstructed a test case using the template. The @ManyToOne-Mapping actually does work with the NaturalId, if it is not an embeddable and its composite attributes are direct attributes of the Region-Entity instead (corresponding working code included as comments). hhh-12930-hibernate-orm-6.zip |