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
2009-01-24 11:59:09
cool answered my question here: http://stackoverflow.com/questions/545047/hibernate-collections-of-collections
Pat
2009-02-13 19:45:16
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
2009-01-24 13:00:27
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
2009-07-14 22:42:34