-->
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: Set Mapping Problem
PostPosted: Thu Sep 10, 2009 10:37 am 
Newbie

Joined: Tue Aug 25, 2009 11:41 am
Posts: 6
Hi,

I have two tables in the database that I am having trouble reflecting their association in a hibernate mapping file. A user group stored in table "tbl_user_group" can belong to several categories and these mappings are stored in another table called "tbl_user_group_category_mapping" which consist of two columns "USER_GROUP_ID" (which is a foreign key referencing tbl_user_group) and "CATEGORY_NAME" which is the name of a category to which the user group belongs. (For reasons I cannot explain here, I cannot use a separate table for categories and then use the mapping table to simply contain the IDs of the user group and the category). My problem is coming up with a set mapping for user group to include this. For instance, if I had a separate table "tbl_category" and associating domain class "Category" I could do the following in the usergroup xml mapping file:
Code:
<set name="categories" table="tbl_user_group_category_mapping">
       <key column="USER_GROUP_ID" not-null="true" />
       <many-to-many column="CATEGORY_ID" class="Category" />
</set>


but since I am not using a separate Category class, how can I achieve something similar.

Much Thanks


Top
 Profile  
 
 Post subject: Re: Set Mapping Problem
PostPosted: Thu Sep 10, 2009 11:49 am 
Newbie

Joined: Tue Aug 25, 2009 11:41 am
Posts: 6
duh.. i can use "element" instead of "many-to-many"


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.