To my understanding of the question, you want to know when it is necessary to use the @Temporal
annotation, and when it is not.
According to this documentation, the annotation is used on java.util
data types. I have been using java.sql
date and time objects, and they do not require this annotation.
The @Temporal
annotation is a way of converting between java API for date and calendar information, and temporal types the database can understand. Please consult this other question for more info.
java.util.Date
has date and time precision, and that is why you need to annotate it with @Temporal
when persisting to a database data type of TIME or DATE.
If you are persisting a java.util.Date
object to a database data type of TIMESTAMP, then that is probably why it works, since both types have the same precision.