On 28 févr. 2012, at 17:59, Steve Ebersole wrote:
Another discrepancy between hbm.xml and annotations currently is the
definition of natural ids. hbm.xml only allows natural ids to be
defined on the root entity, annotations allow it to be defined on any
level of the hierarchy, even across classes.
We need to decide what we want to support. 2 things to consider here are:
1) whether we limit @NaturalId to only root entity meta (and maybe
@MappedSuperclass for root entities)
2) if we do not limit, what @NaturalId spread across a hierarchy "means"
In the second point, consider:
class A
@NaturalId
key1
class AA extends A
@NaturalId
key2
Personally I vote for limiting @NaturalId to the root entity. This
allows caching to work just like it does for identifiers.
I agree with you.