-->
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: Using one-to-one on the many side of a one-to-many relation
PostPosted: Mon Feb 16, 2009 7:18 pm 
Newbie

Joined: Wed Mar 19, 2008 10:46 pm
Posts: 5
Hibernate version: 3.2.6


Gday....

I'm just wondering what is the effect of using one-to-one on the many side of a one-to-many relationship.

i.e.:


Code:
public class Parent{
    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="parent")
  @Cascade({org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
   private List<Child> children;

}


public class Child{
    @OneToOne
    @JoinColumn(name="parent_id")
    private Parent parent;
}



Just wondering.... since it seems to me that from child's perspective... it doesnt care whether the relation is one-to-one or one-to-many (it doesnt know the existence of other siblings)..


Thanks in advance... :)


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.