On 18 Jan 2014, at 08:32, Steve Ebersole <steve(a)hibernate.org> wrote:
As we move to 5.0 and the new unified XML format I'd like to
revisit the
ways we have mapped certain things historically in hbm.xml and improve upon
them when possible. At the moment I am looking at mapping of natural ids.
In hbm.xml the form was to wrap the attributes making up the natural id in
a grouping:
<class name="Person">
<id name="id"/>
<natural-id>
<property name="lastName"/>
<property name="firstName"/>
</natural-id>
...
</class>
in the context of adding cache config aspects I think I prefer this version.
It groups the properties and more importantly allows to specify the mutability and
cache settings on the enclosing node:
<class name="Person">
<id name="id"/>
<natural-id mutable="true|false" cache-region="ABC">
<property name="lastName"/>
<property name="firstName"/>
</natural-id>
...
</class>
This is imo more intuitive then:
...
<natural-id mutable="true|false" cache-region="ABC" />
<basic name="lastName" natural-id="true" />
<basic name="firstName" natural-id="true" />
...
which can become unwieldy if you want these values to exist in other
groupings.
Are there many potential other groups? If it is a rare case, why not just letting
the user repeat the properties per group?
—Hardy