-->
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.  [ 2 posts ] 
Author Message
 Post subject: Cascade delete gives batch update error
PostPosted: Sat Apr 01, 2006 7:59 pm 
Newbie

Joined: Mon Mar 13, 2006 9:46 pm
Posts: 7
Getting this excpetion when i try to delete the entities
Code:
error HibernateException  in deleting the records Could not execute JDBC batch update
org.hibernate.exception.GenericJDBCException: Could not execute JDBC batch update
        at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
        at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:179)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:72)
        at org.hibernate.jdbc.AbstractBatcher.prepareStatement(AbstractBatcher.java:67)
        at org.hibernate.jdbc.AbstractBatcher.prepareBatchStatement(AbstractBatcher.java:148)
        at org.hibernate.persister.collection.AbstractCollectionPersister.remove(AbstractCollectionPersister.java:809)
        at org.hibernate.action.CollectionRemoveAction.execute(CollectionRemoveAction.java:22)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:138)
        at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
        at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:678)
        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:309)
        at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
        at com.uprr.app.eco.DeleteOldData.deleteOldData(DeleteOldData.java:163)
        at com.uprr.app.eco.DeleteOldData.main(DeleteOldData.java:190)
Caused by: java.sql.BatchUpdateException: ORA-01407: cannot update ("ECO"."ECO_HZRD_EMGY_RESP"."STCC_CODE") to NULL

        at oracle.jdbc.driver.DatabaseError.throwBatchUpdateException(DatabaseError.java:367)
        at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:8726)
        at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1722)
        at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:57)
        at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:172)




my mapping files
Code:


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
    <class name="com.uprr.app.eco.persistenceDelete.EcoCmdyDelete" table="ECO_CMDY" schema="ECO">
        <id name="stccCode" type="string">
            <column name="STCC_CODE" length="7" />
            <generator class="assigned" />
        </id>       
        <property name="hzrdInd" type="string">
            <column name="HZRD_IND" length="1" />
        </property>
        <property name="effDate" type="date">
            <column name="EFF_DATE" length="7" />
        </property>
        <property name="cmdyAbrv" type="string">
            <column name="CMDY_ABRV" length="6" />
        </property>
        <property name="intlHmzdCode" type="string">
            <column name="INTL_HMZD_CODE" length="6" />
        </property>
        <property name="svcRqmtCode1" type="string">
            <column name="SVC_RQMT_CODE_1" length="1" />
        </property>
        <property name="svcRqmtCode2" type="string">
            <column name="SVC_RQMT_CODE_2" length="1" />
        </property>
        <property name="svcRqmtCode3" type="string">
            <column name="SVC_RQMT_CODE_3" length="1" />
        </property>
        <property name="wgtTolrFctr" type="integer">
            <column name="WGT_TOLR_FCTR" precision="1" scale="0" />
        </property>
        <property name="cmdyBaseNbr" type="short">
            <column name="CMDY_BASE_NBR" precision="3" scale="0" />
        </property>
        <property name="unnaNbr" type="string">
            <column name="UNNA_NBR" length="6" />
        </property>
        <property name="crtnDt" type="date">
            <column name="CRTN_DT" length="7" not-null="true" />
        </property>
        <property name="crtnUserId" type="string">
            <column name="CRTN_USER_ID" length="8" not-null="true" />
        </property>
        <property name="lastUptdDt" type="timestamp">
            <column name="LAST_UPTD_DT" length="7" not-null="true" />
        </property>
        <property name="lastUptdUserId" type="string">
            <column name="LAST_UPTD_USER_ID" length="8" not-null="true" />
        </property>
        <property name="cmdyDesc" type="string">
            <column name="CMDY_DESC" length="720" />
        </property>
       <!-- <property name="prodClassStcc" type="string">
         <column name="PROD_CLAS_STCC_CODE" length="7" />
      </property> -->
       
        <set name="ecoHzrdEmgyResps" cascade="delete-orphan" >
            <key>
                <column name="STCC_CODE" length="7" not-null="true" />
            </key>
            <one-to-many class="com.uprr.app.eco.persistenceDelete.EcoHzrdEmgyRespDelete" />
        </set>
       
        <set name="ecoCommodities" cascade="delete-orphan">
               <key>
                   <column name="PROD_CLAS_STCC_CODE" length="7"  />
               </key>
               <one-to-many class="com.uprr.app.eco.persistenceDelete.EcoCmdyDelete" />
        </set>
       
        <set name="ecoHzmtDtls" cascade="delete-orphan">
            <key>
                <column name="STCC_CODE" length="7" not-null="true" />
            </key>
            <one-to-many class="com.uprr.app.eco.persistenceDelete.EcoHzmtDtlDelete" />
        </set>
        <set name="ecoHzmtNameDescs" cascade="delete-orphan" >
            <key>
                <column name="STCC_CODE" length="7" not-null="true" />
            </key>
            <one-to-many class="com.uprr.app.eco.persistenceDelete.EcoHzmtNameDescDelete" />
        </set>
    </class>
</hibernate-mapping>




<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
    <class name="com.uprr.app.eco.persistenceDelete.EcoHzrdEmgyRespDelete" table="ECO_HZRD_EMGY_RESP" schema="ECO">
        <composite-id name="id" class="com.uprr.app.eco.persistenceDelete.EcoHzrdEmgyRespId">
            <key-property name="stccCode" type="string">
                <column name="STCC_CODE" length="7" />
            </key-property>
            <key-property name="lineNbr" type="int">
                <column name="LINE_NBR" precision="2" scale="0" />
            </key-property>
        </composite-id>
        <many-to-one name="ecoCmdy" class="com.uprr.app.eco.persistenceDelete.EcoCmdyDelete" update="false" insert="false" fetch="select">
            <column name="STCC_CODE" length="7" not-null="true" />
        </many-to-one>
        <property name="crtnDt" type="date">
            <column name="CRTN_DT" length="7" not-null="true" />
        </property>
        <property name="crtnUserId" type="string">
            <column name="CRTN_USER_ID" length="8" not-null="true" />
        </property>
        <property name="lastUptdDt" type="date">
            <column name="LAST_UPTD_DT" length="7" not-null="true" />
        </property>
        <property name="lastUptdUserId" type="string">
            <column name="LAST_UPTD_USER_ID" length="8" not-null="true" />
        </property>
        <property name="emgyRespText" type="string">
            <column name="EMGY_RESP_TEXT" length="80" not-null="true" />
        </property>
    </class>
</hibernate-mapping>


<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
    <class name="com.uprr.app.eco.persistenceDelete.EcoHzmtNameDescDelete" table="ECO_HZMT_NAME_DESC"  schema="ECO">
        <composite-id name="id" class="com.uprr.app.eco.persistenceDelete.EcoHzmtNameDescId">
            <key-property name="stccCode" type="string">
                <column name="STCC_CODE" length="7" />
            </key-property>
            <key-property name="regAuthCode" type="string">
                <column name="REG_AUTH_CODE" length="1" />
            </key-property>
            <key-property name="nameDescType"  type="string">
                <column name="NAME_DESC_TYPE" length="4" />
            </key-property>
            <key-property name="grpNbr" type="byte">
                <column name="GRP_NBR" precision="2" scale="0" />
            </key-property>
            <key-property name="lineNbr" type="byte">
                <column name="LINE_NBR" precision="2" scale="0" />
            </key-property>
        </composite-id>
        <many-to-one name="ecoHzmtDescLine" class="com.uprr.app.eco.persistenceDelete.EcoHzmtDescLineDelete" fetch="select">
            <column name="NAME_DESC_ID" precision="10" scale="0" not-null="true" />
        </many-to-one>
        <many-to-one name="ecoCmdy" class="com.uprr.app.eco.persistenceDelete.EcoCmdyDelete" update="false" insert="false" fetch="select">
            <column name="STCC_CODE" length="7" not-null="true" />
        </many-to-one>
        <property name="primInd"  type="string">
            <column name="PRIM_IND" length="1" />
        </property>
        <property name="crtnDt" type="date">
            <column name="CRTN_DT" length="7" not-null="true" />
        </property>
        <property name="crtnUserId" type="string">
            <column name="CRTN_USER_ID" length="8" not-null="true" />
        </property>
        <property name="lastUptdDt" type="date">
            <column name="LAST_UPTD_DT" length="7" not-null="true" />
        </property>
        <property name="lastUptdUserId" type="string">
            <column name="LAST_UPTD_USER_ID" length="8" not-null="true" />
        </property>
    </class>
</hibernate-mapping>



<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<!--
        Auto-generated mapping file from
        the hibernate.org cfg2hbm engine
-->
    <class name="com.uprr.app.eco.persistenceDelete.EcoHzmtDescLineDelete" table="ECO_HZMT_DESC_LINE" schema="ECO">
        <id name="nameDescId" type="long">
            <column name="NAME_DESC_ID" precision="10" scale="0" />
            <generator class="assigned" />
        </id>
        <property name="hzmtNameDesc" type="string">
            <column name="HZMT_NAME_DESC" length="25" not-null="true" />
        </property>
        <property name="crtnDt" type="date">
            <column name="CRTN_DT" length="7" not-null="true" />
        </property>
        <property name="crtnUserId" type="string">
            <column name="CRTN_USER_ID" length="8" not-null="true" />
        </property>
        <set name="ecoHzmtNameDescs" inverse="true">
            <key>
                <column name="NAME_DESC_ID" precision="10" scale="0" not-null="true" />
            </key>
            <one-to-many class="com.uprr.app.eco.persistenceDelete.EcoHzmtNameDescDelete" />
        </set>
    </class>
</hibernate-mapping>





Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 02, 2006 4:42 pm 
Newbie

Joined: Mon Mar 13, 2006 9:46 pm
Posts: 7
I figured out the problem for that. Now i have another problem, the entities are not getting deleted. In the console i see delete sql. What could be the problem


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

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.