jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
186 stars 55 forks source link

MapKeyColumn misses secondPrecision member #615

Closed beikov closed 2 months ago

beikov commented 2 months ago

Column received a new member secondPrecision, but apparently it was forgotten on MapKeyColumn. Would be nice to align that and also in the XML.

gavinking commented 2 months ago

This was intentional, not an oversight. I don't think it makes any sense to use a time or timestamp as a map key.

For similar reasons to why it doesn't make sense to use Float or Double—these are all fundamentally approximate types.

gavinking commented 2 months ago

i.e. map keys should always be discrete types: enums, string, integers, etc.

beikov commented 2 months ago

I guess that's also why you deprecated the MapKeyTemporal annotation? I don't have a strong opinion, and I understand that mapping temporals as map key is probably not very common, but I don't see a fundamental problem. Temporals are exact, not like approximate numerics. Anyway, I don't want to start a discussion. Merely wanted to point out this situation because of a Hibernate ORM 7 exception caused by the lack of this member.

gavinking commented 2 months ago

I guess that's also why you deprecated the MapKeyTemporal annotation?

No, that's because we also deprecated @Temporal. Use of java.sql types is deprecated in JPA 3.2.