@NaturalId on non-root entity

Description

Hi there,

@NaturalId only works on root entities. As with JPA 2.2 (Hibernate 5.3), caching is also supported on non root entities, this might be a good opportunity to implement the support of @NaturalId on non root entities as well.

My use case:

For compatibility reasons, we have to stick to the joined inheritance approach. As settings change rarely and are frequently queries by name, type& scope, the idea is to annotate these properies with @NaturalId. As this is currently not working, I'm effectively forced to build a separate caching mechanism. Also in perspective of implementation consistency, I think it makes sense to allow this to somehow stick to JPA 2.2, although this is a native feature.

This is a followup for https://discourse.hibernate.org/t/naturalid-on-non-root-entity/344.

Regards,
Niko

Environment

None

Status

Assignee

Unassigned

Reporter

Niko Wittenbeck

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure