Reputation: 11
I have a Java HashMap object that contians a User object and a Room object. Can Hibernate cope with mapping this to a database, or can hibernate only deal with mapping collections that contain objects of the same type?
Many thanks,
Dave.
Upvotes: 1
Views: 343
Reputation: 103135
You may want to create a common supertype for these objects. If you find that the two types do not have common foundation then maybe they do not belong in the same Map. As far as I know, mapping to two distinct types as you describe is not possible.
Upvotes: 3