-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How to Handle Relation in HBM files?
PostPosted: Wed Oct 10, 2007 11:57 pm 
Newbie

Joined: Mon Jul 16, 2007 9:35 am
Posts: 17
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.