-->
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.  [ 3 posts ] 
Author Message
 Post subject: Composite_id & Primary keys
PostPosted: Wed Nov 02, 2005 12:16 am 
Newbie

Joined: Wed Nov 02, 2005 12:08 am
Posts: 7
Location: Sydney,Australia
Hi,
I have a table that has a primary key and a composite key. I am wondering whether it is possible to map it with an id name as well as with a composite_id name or whether they were mutually exclusive.
eg
<id name="OptionId" type="integer" column="OptionId" unsaved-value="-1">
<generator class="assigned"/>
</id>

<composite-id
name="Id" >
<key-property name="CAId" type="java.math.BigDecimal" column="CAId"/>
<key-property name="ProdType" type="integer" column="ProdType"/>
</composite-id>

The table definitions are :
alter table HIN_CAOptions
add constraint HIN_CAOptions_PK PRIMARY KEY (OptionId)

alter table HIN_CAClientOptions
add constraint HIN_CAClientOptions_PK PRIMARY KEY (OptionId, EntId)


thanks in advance.


Top
 Profile  
 
 Post subject: Composite_id & Primary keys
PostPosted: Wed Nov 02, 2005 12:20 am 
Newbie

Joined: Wed Nov 02, 2005 12:08 am
Posts: 7
Location: Sydney,Australia
Apologies - the composit_id was incorrectly defined in the previous message. I have corrected the definition here.

Hi,
I have a table that has a primary key and a composite key. I am wondering whether it is possible to map it with an id name as well as with a composite_id name or whether they were mutually exclusive.
eg
<id name="OptionId" type="integer" column="OptionId" unsaved-value="-1">
<generator class="assigned"/>
</id>

<composite-id
name="Id" >
<key-property name="EntId" type="integer" column="Entd"/>
<key-property name="OptionId" type="integer" column="OptionId"/>
</composite-id>

The table definitions are :
alter table HIN_CAOptions
add constraint HIN_CAOptions_PK PRIMARY KEY (OptionId)

alter table HIN_CAClientOptions
add constraint HIN_CAClientOptions_PK PRIMARY KEY (OptionId, EntId)


thanks in advance.


Top
 Profile  
 
 Post subject: Re: Composite_id & Primary keys
PostPosted: Wed Nov 02, 2005 12:32 am 
Newbie

Joined: Wed Nov 02, 2005 12:08 am
Posts: 7
Location: Sydney,Australia
please disregard the posting on this topic


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.