[hibernate-dev] mutable versus immutable natural keys

Steve Ebersole steve at hibernate.org
Wed Dec 7 10:29:59 EST 2011

One of the enhancements I want to get into 4.1 is HHH-2879 / HHH-2896 
regarding adding an actual API for entity loading by natural key.

However, I think at the same time we should be more explicit and 
consistent about what it means when we say that a mapped natural key is 
mutable or immutable.  Basically, is "immutable" a hint from the user 
that the values cannot change (so that we can perform certain 
optimizations)?  Or is "immutable" a mandate that we have to verify the 
natural key has not changed, either through Hibernate or "behind" us?

Today we kind of have a blend of those two.

Personally I think we should take it as a hint from the user that the 
values will not change.  WDYT?

steve at hibernate.org

More information about the hibernate-dev mailing list