-->
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.  [ 6 posts ] 
Author Message
 Post subject: How to write mapping for Map<String, Set<String>>
PostPosted: Mon Jun 27, 2005 5:40 am 
Newbie

Joined: Mon Jun 27, 2005 4:22 am
Posts: 10
Location: Hyderabad, India
I have the following scenarios for which i need to write hibernate mapping file.


My POJO has the folllowing structure,

public class Test {

public Test() {
}

private Map<String, Set<String>> variable1;

public void setVariable1(final Map<String, Set<String>> theVariable1) {
variable1 = theVariable1;
}


public Map<String, Set<String>> getVariable1() {
return variable1;
}

private Map<String, Map<String>> variable2;

public void setVariable2(final Map<String, Map<String>> theVariable2) {
variable1 = theVariable2;
}


public Map<String, Set<String>> getVariable2() {
return variable2;
}

}

This object structure is a valid one, as i can implement this object model with out using hibernate. "If something i can do with out using hibernate, i should be able to do that using hibernate too".

I hope everybody accept this statment. Now the problem is i dont know the answer to the following question,

How do i write the hibernate mapping for both these variables, variable1 and variable2 in the Test.hbm.xml file?

Please help me out ASAP.

Thanks,
Amjath Sharief


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 27, 2005 8:31 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
This is not possible. Nested Collections are not supported.


Top
 Profile  
 
 Post subject: How to write mapping for Map<String, Set<String>>
PostPosted: Mon Jun 27, 2005 11:16 am 
Newbie

Joined: Mon Jun 27, 2005 4:22 am
Posts: 10
Location: Hyderabad, India
Dear Hibernate users,

Is there any other work around in hibernate to resolve my object model mapping? Please help me out and provide me some ideas on that.


Thanks,
Amjath Sharief


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 27, 2005 12:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Actually it can be done (but nontrivial) using a UserCollectionType in HB3.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 9:03 am 
Regular
Regular

Joined: Thu Apr 29, 2004 5:08 pm
Posts: 56
Location: Montreal, Quebec, Canada
To resolve this, normally I create a class for the value of the mapped map collection. This new class contains the set.

_________________
- Frank


Top
 Profile  
 
 Post subject: How to write mapping for Map<String, Set<String>>
PostPosted: Wed Feb 11, 2009 4:03 am 
Newbie

Joined: Mon Jun 27, 2005 4:22 am
Posts: 10
Location: Hyderabad, India
Hi,

Can you explain how to do the mapping for the wrapper class which has Set or Map?

An example would be very nice.

I have been struggling with this requirements for years now. Still hibernate has no support for this??

Thanks,
Amjath


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