Change the column type to java.sql.Timestamp and keep the hibernate mapping as 'timestamp'. It will return date+time.
I have mapped the following two columns with Date and TimeStamp type to hibernate type 'timestamp'
private Date myDate; (java.util.Date)
private TimeStamp yourDate; (java.sql.Timestamp)
My database is Oracle. In my tables, I can see that both date and time are stored. When query for myDate and yourDate, only Date is returned.
myDate returns date only.
yourDate returns date+time.
But when you issue a SQL in database with to_char(myDate, 'yyyy-mm-dd hh:mm:ss') it returns date+time. But the java type java.util.Date is returning date only.
Here is what Hibernate docs says:
Quote:
Mapping type-->Java type---->Standard SQL built-in type
date-->java.util.Date or java.sql.Date DATE-->
time-->java.util.Date or java.sql.Time-->TIME
timestamp-->java.util.Date or java.sql.Timestamp-->TIMESTAMP
calendar-->java.util.Calendar-->TIMESTAMP
calendar_date-->java.util.Calendar-->DATE