The format goes like this:
@Temporal(TemporalType.DATE)
@Column(name="CREATED_DATE")
private Date createdDate;
My question is: Why is it necessary to annotate mapped java.util.Date
fields as @Temporal
in javax.persistence
? If the local variable is obviously declared as a Date and the column data type in the DB is also one of the date(time) or timestamp types, shouldn't it be easy to infer that we're dealing with a temporal bit of data without redundantly specifying it in multiple places?
From e.g. java.util.Date it's not obvious if one wants to map to DATE or TIMESTAMP database type. Only exception is java.sql.Date/Time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With