-->
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.  [ 4 posts ] 
Author Message
 Post subject: Still can't get all-delete-orphan to work, please help me
PostPosted: Fri Jul 30, 2004 2:10 pm 
Beginner
Beginner

Joined: Sun Feb 08, 2004 4:09 pm
Posts: 46
Hi,


I already posted about this, but nobody answered, I would really appreciate some help on this.

I just need a mapping example (a working one, cause documentation's example didn't worked...) of both sides of relationships that uses all-delete-orphan.

I'm using latest hibernate with MySQL and JBoss, I think this is only the information needed.


Thanks in advance,
Thiago Souza


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 30, 2004 3:06 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 12:28 pm
Posts: 27
Location: New York
this one worked for me

Code:
<?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
   package="hibernate.testing.model">
    <class
        name="Parent"
        table="tst_parent"
        dynamic-update="false"
        dynamic-insert="false"
    >

        <id
            name="id"
            column="id"
            type="java.lang.Long"
        >
            <generator class="identity">
            </generator>
         
        </id>
      
      <version name="version" column="version" type="long" access="field" />

        <property
            name="name"
            type="java.lang.String"
            update="true"
            insert="true"
            column="name"
        />

        <set
            name="children"
            lazy="true"
            inverse="true"
            cascade="all-delete-orphan"
            sort="unsorted"
        >
              <key
                  column="parent_id"
              />

              <one-to-many
                  class="Child"
              />
        </set>


    </class>
   
    <class
        name="Child"
        table="tst_child"
        dynamic-update="false"
        dynamic-insert="false"
    >

        <id
            name="id"
            column="id"
            type="java.lang.Long"
        >
            <generator class="identity">
            </generator>
         
        </id>

      <version name="version" column="version" type="long" access="field" />

        <many-to-one
            name="parent"
            class="Parent"
            cascade="none"
            outer-join="auto"
            update="true"
            insert="true"
            column="parent_id"
        />
      
        <property
            name="name"
            type="java.lang.String"
            update="true"
            insert="true"
            column="name"
        />
      
    </class>
   
</hibernate-mapping>

_________________
Thanks,
Alex


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 30, 2004 3:07 pm 
Beginner
Beginner

Joined: Wed Jul 21, 2004 12:28 pm
Posts: 27
Location: New York
but I was not using JBoss

_________________
Thanks,
Alex


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 8:08 pm 
Beginner
Beginner

Joined: Sun Feb 08, 2004 4:09 pm
Posts: 46
I'll try that, thanks!!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.