I have a Date type column in Oracle DB and it contains date and time for sure. But when I’m trying to get data in java application it will return date with bunch of zeros instead of real time.
In code it’ll be like:
SQLQuery sqlQuery = session.createSQLQuery("SELECT table.id, table.date FROM table");
List<Object[]> resultArray = sqlQuery.list();
Date date = (Date)resultArray[1];
If it was 26-feb-2010 17:59:16 in DB I’ll get 26-feb-2010 00:00:00
How to get it with time?
I am not an expert with Oracle, but you probably need a
DateTimecolumn type to get a time stamp.With that you need to use
java.sql.TimestampJDBC type.