-->
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: Persisting HashMap with usertype values
PostPosted: Fri Mar 04, 2011 5:42 am 
Newbie

Joined: Fri Mar 04, 2011 5:28 am
Posts: 1
Hi all,

I'm looking for a possibility to store a HashMap.
Code:
Map<AnotherObject, Double[][]>

In order to store Double[][] Arrays I created a usertype which converts the array into a binary format. This works for single objects perfectly (I'm using the @Type(type="...") annotation) like:
Code:
@TypeDefs({
    @TypeDef(name="Matrix", typeClass = MyDoubleArray.class),
    })
public class Test {

@Type(type="Matrix")
private Double[][] test; // This works!

Does anybody know how to do the same with a HashMap? I would like to define the targetClass as "MyMatrix". But I found the ElementCollection annotation only accepting "*.class" values.
Code:
@ElementCollection(targetClass=???)
@MapKeyClass(value=org.myorg.AnotherObject.class)
Map<AnotherObject, Double[][]> testMap = new HashMap<AnotherObject, Double[][]>();


Thanks for helping!


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.