Hi guys!
I appreciate your help in solving a problem I faced:
A code is listed below:
superior_date => is an SQL DATE field
Code:
Property prop = Property.forName("superior_date");
DetachedCriteria crit = DetachedCriteria.forClass(Some.class);
String date = "11-11-2000";
crit.add(prop.like(date, MatchMode.ANYWHERE));
After running the code I get a ClassCastException -> String cannot be cast to java.util.Date;
I am interesting in comparing properties as simple Strings, because sometimes user can enter a part of a date. Therefore I need to convert java.util.Date to String with dd-mm-yyyy format.
How can I affect the generated query and cast target java.util.Date to String?
In HQL there is a
CAST function, but HQL is not acceptable in my case, only Criterias are allowed.
Thank you!