-->
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: Nested CollectionOfElements
PostPosted: Thu Nov 26, 2009 6:04 pm 
Beginner
Beginner

Joined: Tue Nov 03, 2009 9:38 am
Posts: 24
Hi,

I have a simple question with maybe a not so simple answer:

Is it possible to have nested Collection(s)OfElements?

What I mean is this:
Code:
Entity
+-elements (CollectionOfElements)
     +-sub elements (CollectionOfElements)


If yes, how would I declare the join column?

I tried using the entity id for the elements collection inside the entity and using the entity id and the element index for the sub elements inside the elements.
However, when deploying this I get a ConcurrentModificationException.

I hope someone can shed some light on this.

Thanks in advance.

Thomas


Top
 Profile  
 
 Post subject: Re: Nested CollectionOfElements
PostPosted: Fri Nov 27, 2009 1:37 pm 
Newbie

Joined: Wed Oct 21, 2009 7:33 am
Posts: 11
Yes. Consider the mapping example below.

<class name="Product">
<id name="serialNumber" column="productSerialNumber"/>
<set name="parts">
<key column="productSerialNumber" not-null="true"/>
<one-to-many class="Part"/>
</set>
</class>

<class name="Part">
<id name="serialNumber" column="partSerialNumber"/>
<set name="items">
<key column="partSerialNumber" not-null="true"/>
<one-to-many class="Item"/>
</set>
</class>

Class Product{
private Set<Part> parts;
}

Class Part{
private Set<Item> items;
}

Product
+- elements(Parts)
+- subelements(Items)


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.