Thats not legal definition of natural ids. Only the *root entity* can
define natural ids, here A.
On Thu 01 Mar 2012 11:11:47 AM CST, Demetz, Guenther wrote:
Hi Steve,
>> Caching should be using the root persister of the hierarchy for cache keys.
Hm, it probably depends on how you fixed HHH-7129.
Is following hierarchy allowed after HHH-7129 ?
@Entity
class A {
@Id
int id;
}
@Entity
class Subclass1 extends A {
@NaturalId
String name;
}
@Entity
class Subclass2 extends A {
@NaturalId
String card;
}
If it is still allowed, then caching
session.bySimpleNaturalId(SubClass2.class).load("g");
should't use the root persisterA, it should use persisterSubclass2, otherwise
session.bySimpleNaturalId(SubClass1.class).load("g");
would overwrite the previous cached entry, right?
--
steve(a)hibernate.org
http://hibernate.org