-->
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.  [ 5 posts ] 
Author Message
 Post subject: Permanent delete
PostPosted: Tue Oct 11, 2005 11:47 am 
Newbie

Joined: Tue Oct 11, 2005 11:31 am
Posts: 3
2.x with Spring 1.1

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:



General Question for a one to many Relationship:

I have the foll relationship:
Entity (one) to phones (many)
On deleting a phone num from the phone num collection, the phone num record gets de-referenced in the data base, i.e. the entity_id foreign-key is removed but the phone num record still remains, it is not physically deleted.

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
I agree with that statement.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:22 pm 
Newbie

Joined: Tue Oct 11, 2005 11:31 am
Posts: 3
steve wrote:
I agree with that statement.

:)

The purpose was: Is there a way to physically delete the record instead of just de-referencing through Hibernate?

Thanks..


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 12:54 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
yes. search docs/forums/wiki for "delete-orphan" cascade option


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 1:40 pm 
Newbie

Joined: Tue Oct 11, 2005 11:31 am
Posts: 3
steve wrote:
yes. search docs/forums/wiki for "delete-orphan" cascade option


Here're the mapping details:
------------------------------------
<list name="phoneNos" inverse="false" cascade="all-delete-orphan">
<key column="entity_id"/>
<index column="entity_id_index"/>
<one-to-many class="x.y.z.PhoneNumber"/>
</list>
-------------------
<many-to-one name="entity" column="entity_id" class="x.y.z.Entity"/>
-------------------------------------

I delete a given item from the entity's collection and then do a saveOrUpdate(entity);

"delete-orphan" does the same...The problem persists

Thanks again..


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