-->
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: Newbi mapping question
PostPosted: Wed Jan 12, 2005 9:18 am 
Newbie

Joined: Wed Jan 12, 2005 9:05 am
Posts: 2
Hi,

Im new to Hibernate and im impressed so far. However i have a newbi mapping question that I tried to solve for myself last night.

But i have this table:

Code:

create table user_roles (
  user_name         varchar(15) not null,
  role_name         varchar(15) not null,
  primary key (user_name, role_name)
);


But i cant figure out how to map it properly. Could anyone point out any documentation or perhaps give me a clue to how its done?



[/code]


Top
 Profile  
 
 Post subject: Mapping
PostPosted: Wed Jan 12, 2005 9:36 am 
Newbie

Joined: Thu Sep 25, 2003 9:25 am
Posts: 15
How about this?

Code:
   <class name="UserRoles" table="user_roles">
      <composite-id>
         <key-property column="role_name"
            name="roleName" type="string" />
         <key-property column="user_name"
            name="userName" type="string" />
      </composite-id>
   </class>


Top
 Profile  
 
 Post subject: It worked
PostPosted: Thu Jan 20, 2005 5:23 am 
Newbie

Joined: Wed Jan 12, 2005 9:05 am
Posts: 2
However i chose another solution.

Thanks for the reply

_________________
If I'm not back in five minutes...just wait longer!


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.