I have a table in database which has following mapping it does not work:
Code:
---------------------------contact-phone.hbm.xml---------------------
<class name="ContactPhone" table="SPP_AGG_CONTACT_PHONE">
<composite-id>
<key-property name="phoneNumber" column="PHONE_NUMBER" type="string"/>
<key-many-to-one name="contact" column="CONTACT_ID" class="ContactInfo" lazy="false"/>
<key-property name="typeId" column="TYPE_ID" type="integer"/>
</composite-id>
<property name="index" column="ORDER_NUMBER" type="integer"/>
</class>
---------------------------contact.hbm.xml---------------------------
<class name="ContactInfo" table="SPP_AGGREGATOR_CONTACT">
<id name="id" column="CONTACT_ID" unsaved-value="-1" type="long">
<generator class="sequence">
<param name="sequence">SPP_AGG_CONTACT_ID_SEQ</param>
</generator>
</id>
<property name="firstName" column="FIRST_NAME"/>
<property name="lastName" column="LAST_NAME"/>
<property name="createUser" column="CREATE_USER" update="false"/>
<property name="createDate" column="CREATE_DATE" type="calendar_date" update="false"/>
<property name="updateUser" column="UPDATE_USER"/>
<property name="updateDate" column="UPDATE_DATE" type="calendar_date"/>
<many-to-one name="aggregator" class="Aggregator" column="AGGREGATOR_ID" lazy="false" insert="false" update="false"/>
<list name="emailAddress" table="SPP_AGG_CONTACT_EMAIL_ADDR" cascade="all">
<key column="CONTACT_ID"/>
<list-index column="ORDER_NUMBER"/>
<element column="EMAIL_ADDRESS" type="string"/>
</list>
<list name="phoneNumber" table="SPP_AGG_CONTACT_PHONE" cascade="all">
<key column="CONTACT_ID" not-null="true"/>
<list-index column="ORDER_NUMBER"/>
<one-to-many class="ContactPhone"/>
</list>
<set name="notes" table="SPP_CONTACT_NOTES" cascade="save-update" lazy="false" inverse="false" sort="unsorted">
<key column="CONTACT_ID"/>
<many-to-many column="NOTE_ID" class="NoteData"/>
</set>
</class>
I get org.hibernate.MappingException: Repeated column in mapping for entity: com.pge.csis.dr.thirdparty.aggregation.beans.ContactPhone column: CONTACT_ID (should be mapped with insert="false" update="false").
Please advise.....
Peter