[hibernate-dev] Mutable natural key caching?

Elias Ross genman at noderunner.net
Mon Sep 22 12:33:03 EDT 2008


On Mon, Sep 22, 2008 at 3:10 AM, Sanne Grinovero
<sanne.grinovero at gmail.com> wrote:
> I really dislike the idea of having a mutable key,
> am I too extreme? isn't this going to bring you loads of problems?
> IMHO if it's mutable it is not a key, but of course I don't see the big picture:
> I'm just curious about the design decision.

In some cases perfectly good natural keys do change.

In our application a phone number is used to track a user account.
There are several ways this number can change. One is when an area
code splits; although this is more of a North America Numbering Plan
issue than worldwide. Another is if a user moves (again a NANP issue)
and then is issued a new local number.

I don't think supporting this by issuing a cache eviction is too
difficult to support. A cache eviction should occur when an entry with
natural IDs is removed anyway.



More information about the hibernate-dev mailing list