Yes,
good point Guy. There are a few missing cases with map keys in the spec as well
(we were not
sure
whether it was worth adding the extra complexity to handle what
seemed to be less common
case)
but we should probably support this in EclipseLink.
@Convert would apply to the value of the Map, and perhaps we might
introduce a @ConvertKey.
While working on the ElementCollection support, I
noticed there is no way in JPA to specify or support a converter for
a key column in a basic map mapping case.
Note, JPA doesn't have any explicit support
of converters with ElementCollection but we certainly could add some since
internally EclipseLink supports them. As
it is a @Convert (or a JPA converter, @Lob, @Temporal,
@Enumerated) could be applied to the value column of a direct
collection or direct map mapping case, but there is no way to specify a
converter for the map key.
Perhaps we could introduce another
annotation? KeyConverter? MapKeyConverter?
MapKeyColumnConverter?
In the interim, if users wanted a way to have a
key converter they could either use EclipseLink's @BasicMap or a
customizer to add the converter.
Anyway, food for thought over the
holidays.
Cheers,
Guy
|