Hi,
I'v got a problem while triing to map a simple one-to-many association.
My
Fichier object got a list of
Telechargement. I want all Fichier's Telechargement beeing deleted when deleting the Fichier containing them.
But when i try session.delete(myFichier) ;
i've got the following exeption :
Quote:
Caused by: com.sybase.jdbc2.jdbc.SybSQLException: The column req_number in table arte does not allow null values.
here are my mappings :
fichier.hbm.xmlQuote:
<class name="Fichier" table="arfi">
<composite-id name="fichierId" class="FichierId">
<key-property name="requestNumber" Column="req_number"/>
<key-property name="fichierNumber" column="fic_number"/>
</composite-id>
<bag name="telechargements" cascade="all-delete-orphan" table="arte" >
<key foreign-key="true" >
<column name="req_number" />
<column name="fic_number" />
</key>
<one-to-many class="Telechargement"/>
</bag>
</class>
Telechargement.hbm.xmlQuote:
<class name="Telechargement"
table="arte">
<composite-id name="telechargementId"
class="TelechargementId">
<key-property name="requestNumber" column="req_number" />
<key-property name="fichierNumber" column="fic_number" />
<key-property name="userId" column="user_id" />
</composite-id>
</class>
When setting not-null = true in the key element ( <key foreign-key="true" not-null="true"> ) i get the folowing exception :
Quote:
java.lang.Throwable: org.hibernate.MappingException: Repeated column in mapping for entity: com.calyon.ssr.metier.report.Telechargement column: req_number (should be mapped with insert="false" update="false")
Any idea ? Thanks.
( sorry for my poor english ).