-->
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.  [ 1 post ] 
Author Message
 Post subject: Inheritance and NaturalId
PostPosted: Fri Nov 27, 2009 4:24 pm 
Newbie

Joined: Mon Feb 23, 2009 11:16 am
Posts: 17
Hi,

I have a pretty simple setup of two classes.

class A {
@NaturalId
String key

@NaturalId
String key2
}

class B extends A {
@NaturalId
String key3
}

From such a structure I expect there to be a Unique constraint on { key, key2, key3 } such that if any of the 3 keys are different then the whole group (the NaturalId) is considered unique. This is what I have been doing with hibernate and single classes for a while now.

Yet when I attempt to insert a new B with a unique key2 I get an error that I'm violating the uniqueness of key3. Do @NaturalId's not combine across inherited classes? If not does anyone have a suggestion for what I could replace these keys with? Perhaps some sort of unique constraint defined within B...


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

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.