Hi,
I need the solution for the following.
Thank you in advance.
Problem Description
-------------------
I have two tables
User and a Group
In User table the composite key is (cid, groupid, userid)
In Group table the composite key is (cid, groupid)
The (cid, groupid) part of Users' composite key refers the key in Group table
The query to be generated using the association is
select u.cid,u.userid,u.groupid,g.groupname,g.groupdesc from User u, Group g
where u.cid = g.cid and u.groupid = g.groupid;
The hbm files for both the tables is as follows
There is difficulty in providing association for these two tables in the hbm files.
Can any one please help me in this?
Group
-------
<hibernate-mapping default-cascade="none" default-access="property" default-lazy="true" auto-import="true">
<class name="report.bean.user.detail.Group" table="Group">
<composite-id name="GroupKey" class="report.bean.user.detail.GroupId">
<key-property name="cId" />
<key-property name="GroupId"/>
</composite-id>
<property name="GroupName"/>
<property name="GroupDescription"/>
</class>
</hibernate-mapping>
USER
-------
<hibernate-mapping default-cascade="none" default-access="property" default-lazy="true" auto-import="true">
<class name="report.bean.user.detail.User" table="USER">
<composite-id>
<key-property name="cid"/>
<key-property name="GroupId"/>
<key-property name="userId"/>
</composite-id>
<property name="firstname"/>
<property name="lastname"/>
</class>
</hibernate-mapping>
Providing solution for the above is greatly appreciated.
|