-->
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: on cascade delete not working with String array mapping?
PostPosted: Sat Apr 15, 2006 10:19 pm 
Newbie

Joined: Thu Feb 16, 2006 2:28 pm
Posts: 2
I cant seems to delete a parent class with a subclass with an array mapping of Strings. I am using mysql 5.0. and issue the following command

delete com.model.AutoResumeQueryParams where id in (1,2,3);


It just throw a foreign key constraint error, I checked the contraint error against the database and is it definitely the array mapping. how come the array data is not deleted first with cascade?
I already try every cascade option like all and all-delete-orphan but still the same thing.
here is the mapping file

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
      "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">


<hibernate-mapping>
    <class name="com.model.AutoResumeQueryParams" table="auto_query_params" discriminator-value="B">
       <id name="id" column="id" unsaved-value="null">
           <generator class="increment"/>
        </id>
          <discriminator column="QUERY_TYPE" type="string"/>
          <property name="queryName"/>
          <set name="autoTriggers" table="trigger_queryparams" inverse="true" cascade="all" lazy="true">
             <key column="auto_param_id"/>
             <many-to-many column="auto_trigger_id" class="com.model.AutoScheduleJobTrigger"/>
          </set>
          <set name="autoCandidates" table="candidates_queryparams" inverse="true" cascade="all" lazy="true">
             <key column="auto_param_id"/>
             <many-to-many column="auto_cand_id" class="com.model.AutoCandidate"/>
          </set>
   </class>
   <subclass name="com.model.AutoSubParams" extends="com.model.AutoResumeQueryParams" discriminator-value="D">
      <property name="query"/>
         
      <array name="country" table="sub_country" cascade="all-delete-orphan">
         <key column="query_params_id" not-null="true"/>
         <index column="arrayindex"/>
         <element type="java.lang.String"></element>
      </array>
   </subclass>   
</hibernate-mapping>


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.