Hi all,
I have created HBM files for all of my tables.
Whenever i need to acess that Entity,
I do have scenario for the same entity, I want all the relation to be loaded and some case I do want only few relation.
Is there any way explicitly to tell, when creating the object for my entity,
In that particular entity
1) Load only specific one to many relation
2) Load only specific many to many relation.
Is anywhere you can control the values to be laoded while reading the HBM files.
If so How and where to do it?
Sample HBM File for my application
Mapping File:
<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="ApplicationFramework.BE.Case, ApplicationFramework" table="CM_CASE">
<id name="CaseId" type="Int32" unsaved-value="null">
<column name="CASE_ID" length="4" sql-type="int" not-null="true" />
<generator class="assigned" />
</id>
<property name="CaseGroupId" type="Int32">
<column name="CASE_GROUP_ID" length="4" sql-type="int" not-null="true" />
</property>
<property name="CaseCategoryId" type="Int32">
<column name="CASE_CATEGORY_ID" length="4" sql-type="int" not-null="true" />
</property>
<property name="CaseName" type="String">
<column name="CASE_NAME" length="25" sql-type="varchar" not-null="true" />
</property>
<property name="CaseDescription" type="String">
<column name="CASE_DESCRIPTION" length="100" sql-type="varchar" not-null="false" />
</property>
<property name="CaseComments" type="String">
<column name="CASE_COMMENTS" length="1500" sql-type="varchar" not-null="false" />
</property>
<property name="BasedOn" type="String">
<column name="BASED_ON" length="200" sql-type="varchar" not-null="false" />
</property>
<property name="SortOrder" type="Int32">
<column name="SORT_ORDER" length="4" sql-type="int" not-null="true" />
</property>
<property name="ActiveFlag" type="Int32">
<column name="ACTIVE_FLAG" length="4" sql-type="int" not-null="true" />
</property>
<property name="IsCaseValid" type="Int32">
<column name="IS_CASE_VALID" length="4" sql-type="int" not-null="true" />
</property>
<property name="CertificationDate" type="DateTime">
<column name="CERTIFICATION_DATE" length="8" sql-type="datetime" not-null="false" />
</property>
<property name="ResearchLevel" type="String">
<column name="RESEARCH_LEVEL" length="1500" sql-type="varchar" not-null="false" />
</property>
<property name="AlgorithmDocPath" type="String">
<column name="ALGORITHM_DOC_PATH" length="1500" sql-type="varchar" not-null="false" />
</property>
<property name="ClinicalSynopsisPath" type="String">
<column name="CLINICAL_SYNOPSIS_PATH" length="1500" sql-type="varchar" not-null="false" />
</property>
<property name="StandardsNotice" type="String">
<column name="STANDARDS_NOTICE" length="1000" sql-type="varchar" not-null="false" />
</property>
<property name="LockedBy" type="String">
<column name="LOCKED_BY" length="200" sql-type="varchar" not-null="false" />
</property>
<property name="LockedDate" type="DateTime">
<column name="LOCKED_DATE" length="8" sql-type="datetime" not-null="false" />
</property>
<property name="CreateDate" type="DateTime">
<column name="CREATE_DATE" length="8" sql-type="datetime" not-null="true" />
</property>
<property name="ModifyDate" type="DateTime">
<column name="MODIFY_DATE" length="8" sql-type="datetime" not-null="true" />
</property>
<property name="CreatedBy" type="String">
<column name="CREATED_BY" length="50" sql-type="varchar" not-null="true" />
</property>
<property name="ModifiedBy" type="String">
<column name="MODIFIED_BY" length="50" sql-type="varchar" not-null="true" />
</property>
<property name="UserType" type="String">
<column name="USER_TYPE" length="50" sql-type="varchar" not-null="true" />
</property>
<many-to-one name="CaseCategory" class="ApplicationFramework.BE.CaseCategory, ApplicationFramework" lazy="false" insert="false" update="false">
<column name="CASE_CATEGORY_ID" length="4" sql-type="int" not-null="true" />
</many-to-one>
<many-to-one name="CaseGroup" class="ApplicationFramework.BE.CaseGroup, ApplicationFramework" lazy="false" insert="false" update="false">
<column name="CASE_GROUP_ID" length="4" sql-type="int" not-null="true" />
</many-to-one>
<bag name="Rules" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="CASE_ID" />
<one-to-many class="ApplicationFramework.BE.Rule, ApplicationFramework" />
</bag>
<bag name="SetPeriods" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="CASE_ID" />
<one-to-many class="ApplicationFramework.BE.SetPeriod, ApplicationFramework" />
</bag>
<bag name="CriterionMasters" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="CASE_ID" />
<one-to-many class="ApplicationFramework.BE.CriterionMaster, ApplicationFramework" />
</bag>
<bag name="RunCaseLists" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="CASE_ID" />
<one-to-many class="ApplicationFramework.BE.RunCaseList, ApplicationFramework" />
</bag>
</class>
</hibernate-mapping>
Thanks for all your time.
Cheers
Sudhagar.S
|