-->
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: Parent child problem
PostPosted: Sun May 14, 2006 12:48 pm 
Beginner
Beginner

Joined: Sun May 07, 2006 2:44 pm
Posts: 33
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

[b]Hibernate version3

Hey,

I saw a lot of topics on the " Parent child" problem.

But , still dont understand.


suppose Parent can have a lot of childs (one to many)

Is it ok to do:

Child c = new Child();

Parent p = new Parent();

p.getChilds().add(c);

session.save(p)

it dosnt work for me

the parent is cascade - all and inverse - true

what else do i need to do?

Parent
<set name="chi" cascade="all" inverse="true" >
<key column="QID" />
<one-to-many class="hibernate.model.Child" />


Child:
<many-to-one name="par" column="qid" class="hibernate.model.Parent"


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.