-->
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.  [ 4 posts ] 
Author Message
 Post subject: Mapping a collection of collections
PostPosted: Tue May 11, 2010 11:08 am 
Newbie

Joined: Mon Aug 31, 2009 1:19 pm
Posts: 11
Hello,

Have anyone map a SortedMap of collections?
Code:
public class MyEntity{

   private SortedMap<Property, List<Double>> meassures;
   
}


I have follow this steps: http://blog.xebia.com/2007/10/05/mappin ... hibernate/

Code:
public class MyEntity{

   @OneToMany(cascade=CascadeType.ALL)
   @MapKey
   @Sort(type=SortType.NATURAL)
   private SortedMap<Property, Meassure> meassures;
   
}

public class Meassure{

   private Long id;
   private List<Double> meassures;
   
}


but it doesn't works well.
These are the tables that it generates:
Code:
MyEntity_Meassure
-----------------
myEntiti_id
meassure_id

Meassure
--------
meassure_id

Meassure_Meassures
------------------
meassure_id
element


Could anyone help me?


Top
 Profile  
 
 Post subject: Re: Mapping a collection of collections
PostPosted: Tue May 11, 2010 6:45 pm 
Regular
Regular

Joined: Tue May 11, 2010 5:50 pm
Posts: 54
Location: Norman, Ok, U.S.A
Look into @ElementCollection

http://docs.jboss.org/hibernate/stable/ ... ml_single/


Top
 Profile  
 
 Post subject: Re: Mapping a collection of collections
PostPosted: Wed May 12, 2010 8:54 am 
Newbie

Joined: Mon Aug 31, 2009 1:19 pm
Posts: 11
Hi, I have downloaded the last version of hibernate.

@CollectionOfElements now is deprecated, but I don't have the @ElementCollection annotation available ...

Is there something that I'm doing wrong?


Top
 Profile  
 
 Post subject: Re: Mapping a collection of collections
PostPosted: Wed May 12, 2010 11:07 am 
Regular
Regular

Joined: Tue May 11, 2010 5:50 pm
Posts: 54
Location: Norman, Ok, U.S.A
Try javax.persistence.elementcollection
This should be available in the Hibernate jar or if not, you will need javax.persistence


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.