Hello all,
Need help on the date comparison in Hibernate (using Spring). The date (empStDate) is declared in TeraData as Timestamp(6) and in POJO class defined as Date type as Date.
Options tried [both did not work]
1) Modified annotation as @Temporal(TemporalType.TIMESTAMP) and tried to set the parameter before the query
execution. But it would consider the java.sql.TIMESTAMP time and not allowing this type as TYPE for setParameter for hibernate query
(org.hibernate.Query). Hence used the date type only.
2) Set as DATE (not any temporal type) and in the query used CAST as the value passed as STRING with mm/dd/yy format. But the CAST was not even done and error thrown.
hibQuery.append(" and empStDt >= CAST('" + strDateVal + "'' AS TIMESTAMP(0) FORMAT 'DD-MMM-YYYYBHH:MI')");
strDateVal has value 11-DEC-2012 09:23
Any help would be greatly appreciated.
Regards,
satya
|