问题
Normally you'd map a Date as @Temporal(TemporalType.DATE) and you'd map a Map<> as @ManyToMany or @Lob.
Now I am trying to map a Map. I have tried @ManyToMany @Temporal(TemporalType.DATE) but this doesn't seem to work:
Exception Description: The type [class java.util.Map] for the attribute [x] on the entity class [y] is not a valid type for a temporal mapping.
So my question is, how to map a Map containing a Date?
回答1:
Have you tried something like this?
@OneToMany
@MapKeyTemporal(DATE)
protected java.util.Map<java.util.Date, Employee> employees;
来源:https://stackoverflow.com/questions/14859569/jpa-how-to-map-a-map-with-date-as-key