-->
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.  [ 2 posts ] 
Author Message
 Post subject: How to use a composite id with mapping attributes?
PostPosted: Tue Sep 20, 2005 11:54 am 
Newbie

Joined: Wed Aug 31, 2005 8:23 am
Posts: 5
Location: Belgium
Hello,

I'm trying to find out how to use a composite id with mapping attributes.

:?:
Is there an attribute dedicated for <composite-id>?
If not, is there a workaround (using a <component> or something like that?
:?:

I have 2 tables T_company and T_VAT described below.

T_company contains the columns : Id | company name
T_VAT contains the columns : companyId | VAT

I'd like to get the 2 fields of the second table in a composite id with mapping attributes.

Thanks a lot,
David


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 23, 2005 2:13 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Here is an example: (from NHMA.Test)

Code:
[NHMA.CompositeId(0, ClassType=typeof(...))]
   [NHMA.KeyProperty(1, Name="Id")]
   [NHMA.KeyManyToOne(2, Name="Foo", ClassType=typeof(Foo))]
public int Id
{
   get { return _id; }
   set { _id = value; }
}

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


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