I have a stored procedure which is returning a column having datatype as datetime2 in database and Date in Java file. When I am trying to call getTime() on that obtained time from database. It's returning 19994321211 millisecond which is equivalent to Mon May 04 00:00:00 IST 2015. ideally it should return milliseconds of 2015-05-04 15:21:52 as this is the time shown in database when procedure is executed directly.
As I am new to Hibernate , I am unable to understand if the issue is related to hibernate mapping or something else I am missing out.
<hibernate-mapping>
<sql-query name="getMLC">
<return-scalar column="mlcid" type="int" />
<return-scalar column="completionTime" type="date" />
{ call lsc.MLC_Get(:ABC, :XYZ, :ErrorCode)}
</sql-query>
</hibernate-mapping>
class Mlc implements java.io.Serializable {
private Integer mlcid;
private Date completionTime;
// getter and setter
}
If you're using entities you can specify the column type as such:
Try registering a new Driver like this:
and then use this dialect instead:
Also try changing this:
to this: