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
Asked
Active
Viewed 5,259 times
3 Answers
11
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.

Timon
- 132
- 2
- 9

Michael Borgwardt
- 342,105
- 78
- 482
- 720
-
cool answered my question here: http://stackoverflow.com/questions/545047/hibernate-collections-of-collections – Pat Feb 13 '09 at 19:45
-
The link is dead. – Vsevolod Golovanov May 16 '18 at 19:43
-1
There is a multimap over on google collections. I don't know if they are hibernate compatible though.
-1
I have also found something relevent
So can prefer this also.