-->
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: OneToOne + CascadeType.DELETE_ORPHAN
PostPosted: Sat Jan 21, 2006 12:19 pm 
Newbie

Joined: Mon Jan 16, 2006 4:33 am
Posts: 11
I'm wondering if CascadeType.DELETE_ORPHAN is supposed to work with one-to-one relationships. Below is some example code of what I'm trying to do.

Hibernate version: 3.1.1

Mapping documents: 3.1-beta8

Code:
Code:
@Entity
public class Dog extends DomainObject {
   ...
   @OneToOne( mappedBy = "dog", cascade = CascadeType.ALL )
   @Cascade( org.hibernate.annotations.CascadeType.DELETE_ORPHAN )
   private CachedArticle cachedArticle;
   ...
}

@Entity
public class Collar extends DomainObject {
   ...
   @OneToOne
   private Dog dog;
   ...
}

Dog dog = dogDao.getDog( 1 );
Collar collar = dog.getCollar();
assertTrue( collar != null );

dog.setCollar( null );
dog = dogDao.saveDog( dog );
collar = collarDao.getCollar( collar.getId() );
assertTrue( collar == null );


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 6:01 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
no

_________________
Emmanuel


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.