Issue
I have a question regarding Java Hibernate and SQL
I want to add Date field to my entity class. I have used the following date format - 'yyyy-mm-dd' in my DDL script (data.sql) Now I don't know which class to import for the date. Should I import Date from java.util.* or from java.sql.* ?
And which annotations should I add for this column
Thank you in advance
Solution
use java.util.Date and annotation @Temporal(TemporalType.DATE)
import java.util.Date;
class Demo{
@Temporal(TemporalType.DATE)
private Date dateField;
}
Answered By - shubham
Answer Checked By - Willingham (JavaFixing Volunteer)