-->
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: composite-id error - insert/update attribute on column tag?
PostPosted: Thu Jun 10, 2004 11:53 am 
Newbie

Joined: Mon Mar 08, 2004 2:24 pm
Posts: 13
Location: Tampa, FL, USA
I have a class that contains a component with 3 attributes. One of the attributes is used as part of a composite-id in a many-to-one relationship with another class. When trying to update the the class, I get the following exception:

Code:
net.sf.hibernate.MappingException: Repeated column in mapping for class org.arbfile.util.olf.model.Case should be mapped
with insert="false" update="false": branch


I know why I get this... branch is listed twice with update/insert both set to true. I tried to change update/insert to false on the branch in the DocketNumberKey, but received this exception:

Code:
net.sf.hibernate.MappingException: insert="false", update="false" not supported for properties of components: branch


If I change update/insert to false on the composite-id, then the hearyear and hearperiod columns are not updated with the class. I guess what need is the ability to specify update/insert at the column level within the composite-id. Is this possible? Is there another way to do what I'm wanting to do?

Unfortunately, I am tied to a legacy database so composite ids are everywhere. It is likely that branch or some other property will be used as part of several composite-ids in many-to-one relationships. The relevant mapping information is listed below.

Thanks in advance.

Code:
   
    <class  name="org.arbfile.util.olf.model.Case"
            table="a_cca_case"
            dynamic-update="false"
            dynamic-insert="false"
    >

        <id name="docketNo" column="docket_no" type="string" >
            <generator class="assigned">
            </generator>
        </id>

        <component
            name="docketNumberKey"
            class="org.arbfile.util.olf.model.DocketNumberKey"
        >
            <property
                name="program"
                type="string"
                update="true"
                insert="true"
                column="program"
            />

            <property
                name="branch"
                type="string"
                update="true"
                insert="true"
                column="branch"
            />

            <property
                name="sequenceNumber"
                type="string"
                update="true"
                insert="true"
                column="sequence_no"
            />

        </component>

        <many-to-one
            name="hearingCalendar"
            class="org.arbfile.util.olf.model.HearingCalendar"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
        >
            <column name="branch" />
            <column name="hearyear" />
            <column name="hearperiod" />
        </many-to-one>

    </class>


    <class  name="org.arbfile.util.olf.model.HearingCalendar"
            table="a_calendar"
            dynamic-update="false"
            dynamic-insert="false"
    >

        <composite-id>
            <key-property name="branch" column="branch" type="string" />
            <key-property name="hearYear" column="hearyear" type="string" />
            <key-property name="hearPeriod" column="hearperiod" type="integer" />
        </composite-id>


        <property
            name="noticeSent"
            type="string"
            update="true"
            insert="true"
            access="property"
            column="noticesent"
        />

    </class>


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.