I am working on creating a JPA 2.0 compatibility set for my internship. Right now, I am wondering when the @MapKeyTemporal annotation is required and when it is optional ...
I know that when you define a column of a map key using @MapKeyColumn, the type to which the key should be bound can be obtained by looking at the type of the column (and otherwise, the type in the column definition). Thus, in this case, the @MapKeyTemporal annotation is not required.
When you attach the @MapKeyTemporal annotation, the default column name is ATTRIBUTE + "_KEY".
When you do not comment on @MapKeyColumn and @MapKeyTemporal, the default column name is ATTRIBUTE + "_KEY", but what is the default key type? Or should you get an error message?
I was looking for a similar situation and found @MapKeyEnumerated. This is the same with @MapKeyColumn, and it is a value that can be mapped to multiple data types (java.sql.Date/java.sql.Time/java.sql.Timestamp for @MapKeyTemporal and EnumeratedType.ORDINAL
/ EnumeratedType.STRING
for @MapKeyEnumerated). I found one difference: @MapKeyEnumerated has a default value. This default value is EnumeratedType.ORDINAL
.
My question: When using a card with a card key whose base type is a temporary type, what is the default TemporalType (in accordance with JPA 2.0) to which the card key is converted for saving?
Pimgd
source share