Re: [hibernate-dev] mutable versus immutable natural keys

2012-01-26 Thread Eric Dalquist
After our conversion in IRC I think the latest iteration of the idea having the following would suffice: public @interface NaturalId { /** * If the NaturalId can change, either via the application or direct database manipulation */ boolean mutable() default fals

Re: [hibernate-dev] mutable versus immutable natural keys

2012-01-17 Thread Steve Ebersole
In talking with few people that use this feature, there is def a desire to account for both immutable-with-checking and immutable-without-checking. Initially I started down the path of an enum to model this: public enum NaturalIdMutability { MUTABLE, IMMUTABLE, IMMUTABLE_CHECKED,

Re: [hibernate-dev] mutable versus immutable natural keys

2011-12-07 Thread Steve Ebersole
Simple versus compound keys does not effect this discussion of mutable/immutable. Composite natural keys are already supported. On Wed 07 Dec 2011 08:42:11 PM CST, Elias Ross wrote: > On Wed, Dec 7, 2011 at 6:08 PM, Steve Ebersole wrote: > >> But in either case we have a >> violation of the

Re: [hibernate-dev] mutable versus immutable natural keys

2011-12-07 Thread Elias Ross
On Wed, Dec 7, 2011 at 6:08 PM, Steve Ebersole wrote: > But in either case we have a > violation of the immutability. One of the use cases way back when I tried using Natural Keys was for accessing user accounts indexed by phone number. So 90% of our data access pattern was just mapping a phone

Re: [hibernate-dev] mutable versus immutable natural keys

2011-12-07 Thread Steve Ebersole
Part of the problem with saying that a natural key is immutable is when entities are reattached. We do not know whether the application is attempting to update the value. The only solution there is again to read the database snapshot and compare values. Unfortunately that wont tell us whethe

Re: [hibernate-dev] mutable versus immutable natural keys

2011-12-07 Thread Steve Ebersole
There is a 3rd option in regards to immutable... to say that it is immutable, requiring a check. So: 1) mutable 2) immutable (no enforcement) 3) immutable (enforced) > Would the hint mechanism involve any detection of changed values at all? >What would the user see if a natural key were chan

Re: [hibernate-dev] mutable versus immutable natural keys

2011-12-07 Thread Chris Bredesen
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. Woot. > However, I think at the same time we should be more explicit and > consistent about what it means when

[hibernate-dev] mutable versus immutable natural keys

2011-12-07 Thread Steve Ebersole
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.