Hello,
Currently I am using many-to-one element in hbm file to fetch the data object from database like following....
<property name="ContactId" length="4" />
<many-to-one
name="DefaultContact"
column="ContactId"
class="Models.Contact"
update="false"
insert="false"/>
This code is fetching the data properly, but now I need to fetch the data conditionally like I am having the following properties and mant-to-one element in hbm file.....
<property name="ParentId" length="4" />
<property name="ParentType" length="4" />
<many-to-one
name="ContactParent"
column="???????? ParentId which could be CustomerId or ProspectId or LeadId according to Parent Type ????????"
class="???????? Models.Customer or Models.Prospect or Models.Lead - according to Parent Type ????????"
update="false"
insert="false"/>
And I have to fetch the data according to value in "Parent Type" property, which means I need to set class attribute of "many-to-one" element dynamically according to "Parent Type" property.
So now, how can I achieve the desired result with many-to-one element or some other way...?
Thanks in Advance.