I have the following method:
public function listPublished(){
var today = createODBCDate(now());
return ormExecuteQuery("FROM Employment WHERE publishdate <= #today# and expirydate >= #today# ORDER BY tstamp desc");
}
When I run it I am getting the following error:
org.hibernate.QueryException: unexpected char: '{' [FROM EmploymentFindSonographer WHERE publishdate <= {d '2012-10-15'} and expirydate >= {d '2012-10-15'} ORDER BY tstamp desc]
My guess is that HQL requires the format in something other than ODBC date? I also tried passing in a standard CF Date but same error.
Can anyone tell me what format my dates should be in when passing HQL into ormExecuteQuery?
Many Thanks
Simpe version:
Possible problem is that Now() outputs seconds which could give you unexpected results if publishDate and expiryDate keep date+time.
So, possibly more accurate way is this: