Hello fellow hibernaters,
I have a persistent entity with a property that is a collection of primitives (a Map<Long, Integer>), and I want this collection to be loaded automatically using a native SQL query. This is a read-only collection, so I only need it to be loaded along with the object. Is this possible?
It seems like <load-collection> is the closest thing to what I need, however I've only seen it used for collections of entities, not elements such as primitive types. And I've not seen it used for Maps at all, whether they contain entities or primitives.
Worst case I could use the Query API to manually populate the map in my getter method, but I don't want my object model be so closely tied to the persistence API...
Any help with this would be greatly appreciated.
Hibernate version:
Hibernate 3.2.5
Hibernate Annotations 3.3.0 GA
|