-->
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: Mapping problem
PostPosted: Sun Sep 02, 2007 2:24 pm 
Newbie

Joined: Sun Sep 02, 2007 2:02 pm
Posts: 2
Hi,

I am stuck with a mapping problem. I have an accounts table(PycisVO.hbm.xml) and an exception table(Rule.hbm.xml), the relation between the two is many-to-many (RuleException.hbm.xml)

PycisVO.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
    <class name="com.pyramis.pcrui.vo.PycisVO" table="V_PYCIS_DWH_ACCT" schema="PCR">
        <id name="instnIdN" type="java.lang.Long">
            <column name="INSTN_ID_N" precision="12" scale="0" />
            <generator class="assigned" />
        </id>
      <property name="instnNmC" type="java.lang.String">
            <column name="INSTN_NM_C" length="250" />
         </property>
            <property name="tmplTypeLvl1c" type="java.lang.String">
            <column name="TMPL_TYPE_LVL_1_C" length="250" not-null="true"/>
         </property>
        <property name="tmplTypeLvl2c" type="java.lang.String">
            <column name="TMPL_TYPE_LVL_2_C" length="250" not-null="true" />
        </property>
        <property name="tmplTypeLvl3c" type="java.lang.String">
            <column name="TMPL_TYPE_LVL_3_C" length="2000" not-null="true"  />
        </property>
        <property name="dwsAcctId" type="java.lang.Long">
            <column name="DWS_ACCT_ID" precision="12" scale="0" />
        </property>
        <property name="cibsAcctNumN" type="java.lang.Long">
            <column name="CIBS_ACCT_NUM_N" precision="12" scale="0" />
        </property>
        <property name="qimdPortfNumC" type="java.lang.String">
            <column name="QIMD_PORTF_NUM_C" length="250" scale="0" />
        </property>
        <property name="cibsDiscNmC" type="java.lang.String">
            <column name="CIBS_DISC_NM_C" length="50" />
        </property>
        <property name="cibsDiscCodeC" type="java.lang.String">
            <column name="CIBS_DISC_CODE_C" length="30" />
        </property>
        <property name="cibsSubdiscCodeC" type="java.lang.String">
            <column name="CIBS_SUBDISC_CODE_C" length="50" />
        </property>
        <property name="cibsSubdiscNmC" type="java.lang.String">
            <column name="CIBS_SUBDISC_NM_C" length="50" />
        </property>
        <property name="cibsStrucCodeC" type="java.lang.String">
            <column name="CIBS_STRUC_CODE_C" length="50" />
        </property>
        <property name="qimdStrucCodeC" type="java.lang.String">
            <column name="QIMD_STRUC_CODE_C" length="50" />
        </property>
        <property name="imBrandCodeC" type="java.lang.String">
            <column name="IM_BRAND_CODE_C " length="50" />
        </property>
        <property name="asapAcctNmC" type="java.lang.String">
            <column name="ASAP_ACCT_NM_C" length="50" />
        </property>
        <property name="asapAcctNumN" type="java.lang.Long">
            <column name="ASAP_ACCT_NUM_N" precision="17" scale="0" />
        </property>
       
        <set name="exceptions" table="RULE_EXCEPTION">
           <key column="instnIdN"/>
           <many-to-many column="ruleIdN" class="com.pyramis.pcrui.vo.RuleVO"/>
       </set>
    </class>
</hibernate-mapping>


Rule.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
    <class name="com.pyramis.pcrui.vo.RuleVO" table="RULE" schema="CPR">
        <id name="ruleIdN" type="java.lang.Long">
            <column name="RULE_ID_N" precision="12" scale="0" />
            <generator class="assigned" />
        </id>
      <property name="subjCodeC" type="java.lang.String">
            <column name="SUBJ_CODE_C" length="12" not-null="true" />
         </property>
            <property name="applCodeC" type="java.lang.String">
            <column name="APPL_CODE_C" length="12" not-null="true" />
         </property>
        <property name="ruleSeqN" type="java.lang.Long">
            <column name="RULE_SEQ_N" precision="2" scale="0" not-null="true" />
        </property>
        <property name="ruleDescC" type="java.lang.String">
            <column name="RULE_DESC_C" length="2000" />
        </property>
        <property name="rulePrdTypeC" type="java.lang.String">
            <column name="RULE_PRD_TYPE_C" length="12" />
        </property>
        <property name="actvFlgC" type="java.lang.String">
            <column name="ACTV_FLG_C" length="1" />
        </property>
        <property name="dfltXcptIdN" type="java.lang.Long">
            <column name="DFLT_XCPT_ID_N" precision="12" scale="0" />
        </property>
        <property name="asOfDataFlgC" type="java.lang.String">
            <column name="AS_OF_DATA_FLG_C" length="1" />
        </property>
        <property name="dbProcNmC" type="java.lang.String">
            <column name="DB_PROC_NM_C" length="30" />
        </property>
        <property name="infaMapNmC" type="java.lang.String">
            <column name="INFA_MAP_NM_C" length="50" />
        </property>
        <property name="lstTrgrTsD" type="java.util.Date">
            <column name="LST_TRGR_TS_D" length="7" />
        </property>
        <property name="sysUpdTsD" type="java.util.Date">
            <column name="SYS_UPD_TS_D" length="7" />
        </property>
        <property name="infaSessNmC" type="java.lang.String">
            <column name="INFA_SESS_NM_C" length="50" />
        </property>
        <property name="infaMpltNmC" type="java.lang.String">
            <column name="INFA_MPLT_NM_C" length="50" />
        </property>
    </class>
</hibernate-mapping>


RuleExceptionVO.hbm.xml
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
    Mapping file autogenerated by MyEclipse - Hibernate Tools
-->
<hibernate-mapping>
    <class name="com.pyramis.pcrui.vo.RuleExceptionVO" table="RULE_EXCEPTION" schema="CPR">
        <composite-id name="id" class="com.pyramis.pcrui.vo.RuleExceptionId">
            <key-property name="subjCodeC" type="java.lang.String">
                <column name="SUBJ_CODE_C" length="12" />
            </key-property>
            <key-property name="applCodeC" type="java.lang.String">
                <column name="APPL_CODE_C" length="12" />
            </key-property>
            <key-property name="entiKeyIdN" type="java.lang.Long">
                <column name="ENTI_KEY_ID_N" precision="12" scale="0" />
            </key-property>
            <key-property name="refColValC" type="java.lang.String">
                <column name="REF_COL_VAL_C" length="20" />
            </key-property>
            <key-property name="dataDtD" type="java.util.Date">
                <column name="DATA_DT_D" length="7" />
            </key-property>
            <key-many-to-one name="rule" class="com.pyramis.pcrui.vo.RuleVO">
                <column name="RULE_ID_N" precision="12" scale="0" />
            </key-many-to-one>
        </composite-id>
        <property name="cyclDtD" type="java.util.Date">
            <column name="CYCL_DT_D" length="7" not-null="true" />
        </property>
        <property name="xcptIdN" type="java.lang.Long">
            <column name="XCPT_ID_N" precision="12" scale="0" />
        </property>
        <property name="xcptMemoC" type="java.lang.String">
            <column name="XCPT_MEMO_C" length="2000" />
        </property>
        <property name="xcptClrDtD" type="java.util.Date">
            <column name="XCPT_CLR_DT_D" length="7" />
        </property>
        <property name="xcptClrFlgC" type="java.lang.String">
            <column name="XCPT_CLR_FLG_C" length="1" />
        </property>
        <property name="sysUpdTsD" type="java.util.Date">
            <column name="SYS_UPD_TS_D" length="7" />
        </property>
    </class>
</hibernate-mapping>


What i am trying to achive here is when i do "from PycisVo as pycis ", i should get all the excpetions for all the accounts.

1) Firstly this is taking too much time
2) Can you tell me if this mapping is correct.
3) how else can i achieve this by writing a join between the three objects.

Thanks,
Rohit
[/code]


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.