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: Code Mapping for a 2 pk table
PostPosted: Mon Jan 29, 2007 5:00 am 
Newbie

Joined: Mon Jan 29, 2007 4:44 am
Posts: 1
Hibernate version: 1.0.3

Name and version of the database you are using: MS SQL Server 2000


Hi,

i'm trying to create a mapping for a table with 2 PK.
I've tried something like that, but this doesn't work :

Code:
   [NHibernate.Mapping.Attributes.Class(Table = "MaTable")]
   public class MaTable   {
      private string _id1 ;
                [NHibernate.Mapping.Attributes.Id(Name="Id1")]
      [NHibernate.Mapping.Attributes.Generator(1, Class = "uuid.hex")]
      public string Id1
      {
         get
         {
            return _id1 ;
         }
         set
         {
            _id1 = value;
         }
      }

      private string _id2;
      [NHibernate.Mapping.Attributes.Id(Name="Id2")]
      [NHibernate.Mapping.Attributes.Generator(1, Class = "uuid.hex")]
      public virtual string Id2
      {
         get
         {
            return _id2;
         }
         set
         {
            _id2= value;
         }
      }
   }


Anybody know how to do the mapping ?
Thanks in advance.


Top
 Profile  
 
 Post subject: Composite ID
PostPosted: Mon Jan 29, 2007 5:40 am 
Beginner
Beginner

Joined: Mon Jan 08, 2007 11:59 pm
Posts: 31
I think you need to use the CompositeID Attribute

Job Samuel


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.