Hello,<br>
<br>
I am having a problem to insert or update the Exam object, as follow:<br>
<br>
Exam.hbm.xml<br>
[code]<br>
<span class="postbody"><pre><!DOCTYPE hibernate-mapping PUBLIC<br> "-//Hibernate/Hibernate Mapping DTD 3.0//EN"<br> "<a href="http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd
</a>" ><br> <br> <hibernate-mapping><br> <!-- <br> Created by the Middlegen Hibernate plugin 2.2<br> <br> <a href="<a href="http://boss.bekk.no/boss/middlegen/">http://boss.bekk.no/boss/middlegen/
</a>" target="_blank" rel="nofollow"><a href="http://boss.bekk.no/boss/middlegen/">http://boss.bekk.no/boss/middlegen/</a></a><br> <a href="<a href="http://www.hibernate.org/">
http://www.hibernate.org/</a>" target="_blank" rel="nofollow"><a href="http://www.hibernate.org/">http://www.hibernate.org/</a></a><br> --><br> <br> <class <br> name="Exam"
<br> table="exam"<br> ><br> <br> <composite-id name="comp_id" class="ExamPK"><br> <key-property <br> name="cdUnit" <br> column="cd_unit"
<br> type="java.lang.Integer"<br> length="4"<br> /><br> <key-property <br> name="cdExam" <br> column="cd_exam"
<br> type="java.lang.Integer"<br> length="4"<br> /><br> </composite-id> <br> <br> <many-to-one<br> name="pacient"<br> class="Pacient"
<br> not-null="true"<br> update="false"<br>         insert="false"<br> ><br> <column name="cd_pacient" /><br> <column name="cd_unit" />
<br> </many-to-one><br> <br> </class><br> </hibernate-mapping><br><br> [/code]<br> <br>The problem is that the association with pacient is not pesisting in the database, due to update="false" insert="false" configuration.
<br>But without this configuration, occour a mapping error:<span class="postbody"> org.hibernate.MappingException: Repeated column in mapping for entity:<br>Exam column: cd_unit (should be mapped with insert="false" update="false").
<br><br>The exam table have as PK (cd_exam and cd_unit) e the pacient table PK (cd_pacient and cd_unit).<br>But I need to persist the reference to pacient when I am insert or update the exam objet in the database.<br><br>
Please could anyone help me?<br></span><br>Thanks,<br>Rufino.<br></pre></span><br>