views:

667

answers:

3

I need a collection that stores entries as key-value pairs (so I can look up values by a key), but I need one that allows multiple values to share the same key using hibernate

+5  A: 

A map with multiple values for one key is known as a multimap - there's an implementation in the Apache commons library. Hibernate does not support this kind of collection directly, but it can be extended to do so relatively easily by implementing the UserCollectionType interface. This blog article describes how to do it in detail.

Michael Borgwardt
cool answered my question here: http://stackoverflow.com/questions/545047/hibernate-collections-of-collections
Pat
A: 

thx for help ... i hav also find some thing relevent http://commons.apache.org/collections/api-3.1/org/apache/commons/collections/MultiMap.html#get(java.lang.Object)

so can prefer this also..

vyom
A: 

Hi

Have you checked the google collections ? There is a multimap over there too

I don't know if they are hibernate compatible though

krumpi