-->
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: Parent/Child composite key ORDER
PostPosted: Thu Sep 30, 2004 12:07 pm 
Newbie

Joined: Thu Sep 30, 2004 11:46 am
Posts: 1
Strange behaviour with Set and Composite Key

I see that in parent/child relationship where parent key is composite if I change on child the key order a wrong query is generated (verified by SQL Profiler - P6SPY) and my application throws error!

Code snippet:

PARENT
Code:
   <class
    name="ParentXXXX"
    table="PARENT"
>
    .......
    .......
    <composite-id name="pk"     class="ParentXXXX_PK">
        <key-property
            name="fkFunctionId"
            column="FK_FUNCTION_ID"
            type="long"
            length="22"
        />
        <key-property
            name="fkRoleId"
            column="FK_ROLE_ID"
            type="long"
            length="22"
        />
    </composite-id>   
   ......
   ......
    <set name="constraints" lazy="false" inverse="true" cascade="save-update">
        <key>
            <column name="FK_FA_FUNCTION_ID" />
            <column name="FK_FA_ROLE_ID" />
        </key>
        <one-to-many class="ChildXXXX" />
    </set>




CHILD (wrong code: exchange VALUE of FK_FA_ROLE_ID and FK_FA_FUNCTION_ID on SELECT)
Code:
   
   <class
    name="ChildXXXX"
    table="CHILD"
>
    .......
    .......
    <many-to-one
        name="parent"
        class="ParentXXXX"
    >
        <column name="FK_FA_ROLE_ID" />
        <column name="FK_FA_FUNCTION_ID" />
    </many-to-one>



CHILD (it's OK)
Code:
   
    <many-to-one
        name="parent"
        class="ParentXXXX"
    >
        <column name="FK_FA_FUNCTION_ID" />
        <column name="FK_FA_ROLE_ID" />
    </many-to-one>


Is this behaviour correct??????


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.