-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: natural id immutable behaviour
PostPosted: Mon Jun 06, 2005 10:17 am 
Newbie

Joined: Fri Jun 03, 2005 3:58 am
Posts: 1
Hello,

I'm using hibernate for the first time.
I just found out that changing the value of a natural-id property (introduced in 3.0.5) will not change that property on the db (as mutable defaults to false), but will also not throw an exception when calling Session.update(changedObject).

Shouldn't this throw some kind of ConstraintViolationException?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 10:22 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Well, the thing is...we don't really want to take the cost of dirty-checking the natural-id.

Note that you *can* have an updatable natural-id, simply use <natural-id mutable="true">, its just not the default.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 06, 2005 10:27 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
well, why not...

http://opensource.atlassian.com/project ... se/HHH-586


Top
 Profile  
 
 Post subject: What about saving a new object that violates the natural-id?
PostPosted: Tue May 30, 2006 9:50 pm 
Newbie

Joined: Tue May 30, 2006 9:29 pm
Posts: 2
OK, and if we try to create and save a new object which violates the natural-id should we expect an exception also? Or is the natural-id only for fast lookups using Restrictions.naturalId() and database constraint generation?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.