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