-->
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: Naming Foreign Keys Defined In Abstract Superclass
PostPosted: Fri Feb 02, 2007 7:36 pm 
Newbie

Joined: Thu Feb 01, 2007 7:29 pm
Posts: 5
I have an abstract class mapping that defines a composite-id. The composite-id has 2 <key-many-to-one> properties that each define a foreign key. There are many concrete subclasses whose mappings create tables that have the foreign key constraints. The name of the foreign key is a generated name like this: FKB948BFAD9734296A. If I name the foreign key in the abstract class it only provides a prefix to the name like this: PARENT_ID_FK3b6e8e80.

Is there anyway I can name these foreign keys specifically for each subclass?

Here's the abstract class mapping:

<class
name="AbstractContent" abstract="true">

<composite-id
name="CONTENT_PK"
class="ContentKey">

<key-property
name="index"
column="NDX"
type="integer" />
<key-many-to-one
name="parent"
column="PARENT_ID"
foreign-key="PARENT_ID_FK"
class="ContentObject">
</key-many-to-one>
<key-many-to-one
name="feature"
column="FEATURE_ID"
foreign-key="FEATURE_ID_FK"
class="AbstractFeature">
</key-many-to-one>
</composite-id>
</class>

Here's one of the concrete subclass mappings:

<union-subclass
table="BOOLEAN_CONTENT"
name="BooleanContent"
extends="AbstractContent">

<property
name="value"
column="VALUE"
type="boolean"
not-null="true">
</property>
</union-subclass>

Thx,

Dan


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.