So I have a class similar to this
public class MyClass{
...
@ElementCollection
private Map<Long,Map<Long,Double>> Vs = new HashMap<Long, Map<Long,Double>>();
...
}
This returns an error when I try to persist the class:
org.hibernate.MappingException: Could not determine type for: java.util.Map, at table: MyClass_Vs, for columns: [org.hibernate.mapping.Column(Vs)]
I think the error is because there is a map inside the original map that has the annotation of @ElementCollection. Any idea of how to solve this?
I really doubt Hibernate will be able to handle this type of mapping for you with just
@ElementCollection. You probably will need to define a new composite key, containing both of thoseLongmap keys as@Idfields, then use an element collection on aMap<CompositeLong, Double>. Granted, I'm making some assumptions about what thoseLongvalues represent, but it's hard to tell without more context.