-->
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: Null values and Cascade deleting
PostPosted: Tue Sep 04, 2007 11:03 am 
Newbie

Joined: Tue Sep 04, 2007 10:22 am
Posts: 5
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.xml
Quote:

<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.xml
Quote:
<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 ).


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.