-->
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: Deleting child records using hiberate
PostPosted: Thu Feb 12, 2009 12:57 pm 
Beginner
Beginner

Joined: Thu Dec 11, 2008 8:18 am
Posts: 35
In the application the relationship is one to many.I am using DB2. When i am inserting from application both parent and child records are creating. But when i am deleting it is throwing following exception.

[2/12/09 21:34:34:442 IST] 3021d4b5 SystemOut O Hibernate: update RNT_CHG_VND set RNT_CHG_HST_ID=null where RNT_CHG_HST_ID=?
[2/12/09 21:34:34:442 IST] 3021d4b5 SystemOut O Hibernate: update INT_CMP_RNT set RNT_CHG_HST_ID=null where RNT_CHG_HST_ID=?
[2/12/09 21:34:34:629 IST] 3021d4b5 JDBCException W net.sf.hibernate.util.JDBCExceptionReporter SQL Error: -407, SQLState: 23502
[2/12/09 21:34:34:629 IST] 3021d4b5 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter [IBM][CLI Driver][DB2/NT] SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=2, COLNO=1" is not allowed. SQLSTATE=23502

[2/12/09 21:34:34:644 IST] 3021d4b5 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter could not delete collection: [com.kroger.accounting.rem.bo.RentChange.interCompanyRentPayee#57126]
[2/12/09 21:34:34:660 IST] 3021d4b5 JDBCException E net.sf.hibernate.util.JDBCExceptionReporter TRAS0014I: The following exception was logged COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0407N Assignment of a NULL value to a NOT NULL column "TBSPACEID=2, TABLEID=2, COLNO=1" is not allowed. SQLSTATE=23502



I have used the following hbm files..

parent table configuration

<hibernate-mapping>
<class
name="com.kroger.accounting.rem.bo.RentChange"
table="RNT_CHG_HST"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="RNT_CHG_HST_ID"
type="long"
unsaved-value="0"
>
<generator class="native">
</generator>
</id>

<property
name="arrears"
type="java.lang.Boolean"
update="true"
insert="true"
column="ARR_FL"
/>

<property
name="effectiveDate"
type="java.sql.Date"
update="true"
insert="true"
column="RNT_CHG_EFF_DT"
/>

<property
name="oneTimePayDate"
type="java.sql.Date"
update="true"
insert="true"
column="OTM_PMT_DT"
/>

<property
name="endDate"
type="java.sql.Date"
update="true"
insert="true"
column="RNT_CHG_END_DT"
/>
<bag
name="interCompanyRentPayee"
lazy="false"
inverse="false"
cascade="all-delete-orphan"
>

<key>
<column name="RNT_CHG_HST_ID"/>
</key>

<one-to-many
class="com.kroger.accounting.rem.bo.InterCompanyRent"
/>
</bag>

<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-RentChange.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>

And the child table configuration is

<?xml version="1.0"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class
name="com.kroger.accounting.rem.bo.InterCompanyRent"
table="INT_CMP_RNT"
dynamic-update="false"
dynamic-insert="false"
>

<id
name="id"
column="INT_CMP_RNT_ID"
type="long"
unsaved-value="0"
>
<generator class="native">
</generator>
</id>

<many-to-one
name="rentChange"
class="com.kroger.accounting.rem.bo.RentChange"
cascade="none"
outer-join="auto"
update="false"
insert="false"
>
<column
name="RNT_CHG_HST_ID"
/>
</many-to-one>
<property
name="rentChangeId"
type="java.lang.Long"
update="true"
insert="true"
column="RNT_CHG_HST_ID"
/>

<property
name="interCompanyRentAmount"
type="java.math.BigDecimal"
update="true"
insert="true"
column="INT_CMP_RNT_AMT"
/>

<property
name="InterCompanyRemExpensiveAcNumber"
type="com.kroger.accounting.rem.util.TrimmedUppercaseString"
update="true"
insert="true"
column="INT_CMP_REM_ACC_NO"
/>

<property
name="InterCompanyRetExpensiveNumber"
type="com.kroger.accounting.rem.util.TrimmedUppercaseString"
update="true"
insert="true"
column="INT_CMP_RET_ACC_NO"
/>

<property
name="divisionId"
type="java.lang.Long"
update="true"
insert="true"
column="REM_DIV_ID"
/>




<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-RentChange.xml
containing the additional properties and place it in your merge dir.
-->

</class>

</hibernate-mapping>


can you please help me how to resolve this issue.

Thanks.


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.