-->
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: Repeated column in mapping for entity
PostPosted: Thu Apr 03, 2008 11:40 am 
Newbie

Joined: Thu Mar 13, 2008 12:37 pm
Posts: 8
I got the following exception in my Hibernate mapping file, however, the attributes insert and update are not valid for <one-to-many> tag. Not sure how I can fix the problem. I am using hibernate-mapping-3.0.dtd and Hibernate 3.2.4. Please help.
Code:
Caused by: org.hibernate.MappingException: Repeated column in mapping for entity: test.model.data.SolutionStaffing column: SOLUTION_ID (should be mapped with insert="false" update="false")


Sample table structure:
Code:
CREATE TABLE TEMP.SOLUTION_STAFFING (
SOLUTION_ID BIGINT NOT NULL,
JR_SS_ID INTEGER NOT NULL,
RATIO   DOUBLE,
PRIMARY KEY (SOLUTION_ID, JR_SS_ID)
);

CREATE TABLE TEMP.ITEM_MONTHLY_REPORT (
ITEM_ID BIGINT NOT NULL,
YEAR SMALLINT NOT NULL,
MTH SMALLINT NOT NULL,
ITEM_SOL_ID BIGINT,
PRIMARY KEY(ITEM_ID, YEAR, MTH)
);


Mapping file for table ITEM_MONTHLY_REPORT:
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">
<hibernate-mapping>

   <class name="test.model.data.ItemMonthlyReport" table="ITEM_MONTHLY_REPORT" mutable="false" dynamic-insert="false" dynamic-update="false" schema="TEMP">
   <!-- common starts -->
       <composite-id name="id" class="test.model.data.ItemMthId">
            <key-property name="itemId" type="long">
                <column name="ITEM_ID" />
            </key-property>
            <key-property name="mth" type="int">
                <column name="MTH" />
            </key-property>
            <key-property name="year" type="int">
                <column name="YEAR" />
            </key-property>
        </composite-id>
       
        <property name="itemSolutionId" type="java.lang.Long">
            <column name="ITEM_SOL_ID" />
        </property>

        <set name="solutionStaffingSet" lazy="true" >
       <key column="SOLUTION_ID" not-null="true" property-ref="itemSolutionId"/>
               <one-to-many class="test.model.data.SolutionStaffing" />
       </set> 
 
</class>
</hibernate-mapping>


Mapping file for table SOLUTION_STAFFING.
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">
<hibernate-mapping>
    <class name="test.model.data.SolutionStaffing" table="SOLUTION_STAFFING" schema="TEMP">
        <composite-id name="id" class="test.model.data.SolutionStaffingId" >
            <key-property name="solutionId" type="long" >
                <column name="SOLUTION_ID" />
            </key-property>
            <key-property name="jrSsId" type="int">
                <column name="JR_SS_ID" />
            </key-property>
        </composite-id>
       <property name="ratio" type="java.lang.Double">
            <column name="RATIO" precision="53" scale="0" />
        </property>
    </class>
</hibernate-mapping>


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.