-->
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: using composite-key within a Collection Mapping
PostPosted: Tue Feb 19, 2008 5:40 am 
Newbie

Joined: Tue Feb 19, 2008 5:13 am
Posts: 2
Is this possible?

The table I'm mapping has a composite key consisting of 4 columns. I'm coding against a legacy database, and there is no way the organization is going to allow changes to the very ungortunate database design.

Mapping the table goes fine, in this manner (using .Net attributes)

[CompositeId(1)]
[KeyProperty(2, Name = "CrossRefNo", TypeType = typeof(Int32))]
[Column(3, Name = "crossrefno", NotNull = true)]
[KeyProperty(4, Name = "FromObjId1", TypeType = typeof(Int32))]
[Column(5, Name = "fromobjid1", NotNull = true)]
[KeyProperty(6, Name = "ToObjId1", TypeType = typeof(Int32))]
[Column(7, Name = "toobjid1", NotNull = true)]
[KeyManyToOne(8, Name = "CrossRefType", Class = "CrossReferenceType")]
[Column(9, Name = "crossreftype")]

But using this class in a List, from another NHibernate mapping Class seems problematic, as all documentation seems to indicate that List needs a unique key

<list name="MessageList" cascade="all">
<key column="ConversationId"/>
<index column="`Order`"/>
<one-to-many
class="UniDirectional.Message, NHibernateOneToMany"/>
</list>

What I need is a way to define a List within a NHibernate mapping class, that has a composite foreign key. Is this possible? Anyone found a way around this problem?


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.