Hello,
I have two entities Enterprise and EnterpriseGroupDefault. Enterprise is the parent entity. EnterpriseGroupDefault has composite primary keys. Its mapping is given below:
Code:
<class name="Enterprise" table="Enterprise">
<id name="enterpriseId" column="EnterpriseID" />
<property name="activeFlag" column="Active" />
<property name="createdDate" column="dt_created" />
<property name="createdBy" />
<set name="enterpriseGroupDefault" lazy="true" inverse="true">
<key column="enterpriseId" />
<one-to-many class="EnterpriseGroupDefault" />
</set>
<\class>
<class name="EnterpriseGroupDefault" table="EnterpriseGroupDefaults" >
<composite-id
access="property" class="com.pgi.server.dao.enterprise.pk.EnterpriseGroupDefaultPK"
mapped="true">
<key-many-to-one name="enterprise" class="Enterprise" column="enterpriseid" />
<key-property name="groupCode" />
</composite-id>
<property name="createdBy" />
<property name="createdDate" column="dt_created" />
<property name="isActive" column="Active" />
</class>
Now when I execute session.createQuery("from Enterprise") HQL, it executes successfully but it also fetches the child entity(EnterpriseGroupDefault), which I do not want to happen. Can anyone suggest what is going wrong here?
Thanks
Shimit