-->
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: Mapping for: Class containing objects of the same Class Type
PostPosted: Fri Jul 28, 2006 9:50 am 
Newbie

Joined: Fri Jul 28, 2006 9:34 am
Posts: 4
Location: United States
I have two classes Form and a Group (of questions). A Form can contain a Group (of Questions). Similary a Group can contain another Group of questions.

Here are my POJOs:

public class Form {

private String formId;
private String formName;
private Set areas = new HasSet();

}


public class Group{

private String groupId
private String groupName;
private Set groups= new HasSet();

}


I know how to define a mapping for the Form class (given below).
<hibernate-mapping>

<class name="dci.model.Form" table="form">
<id name="formId" column="formId">
<generator class="native"/>
</id>
<property name="formName" />
<property name="formDescription"/>
<set name="groups" table="form_area" lazy="false" cascade="all">
<key column="formId"/>
<many-to-many column="groupId" class="dci.model.Group"/>
</set>
</class>

</hibernate-mapping>

How do I do definite this set mapping for a Group? Since a group can contain other Groups. I want to be able to do something to the effect:

<set name="groups" table="group_definition" lazy="false" cascade="all">
<key column="groupId"/>
<many-to-many column="subGroupId" class="dci.model.Group"/>

Thanks for your reply (in advance).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 28, 2006 11:15 am 
Newbie

Joined: Fri Jul 28, 2006 9:34 am
Posts: 4
Location: United States
Is this even possible? Seems like it should be. I followed the example of "kittens" and "Cats" in the hibernate documentation but that didn't help. Any one have any ideas?


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