[hibernate-dev] mutable versus immutable natural keys

Chris Bredesen cbredesen at redhat.com
Wed Dec 7 10:37:33 EST 2011

On 12/07/2011 10:29 AM, Steve Ebersole wrote:
> 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?

Would the hint mechanism involve any detection of changed values at all? 
  What would the user see if a natural key were changed?


More information about the hibernate-dev mailing list