[coldbox-3.5.0] criteria builder + isGE() + date values

this:

var summaries = getSummaryService() .newCriteria()
.isIn(“insco”,arguments.inscoCodes)
.isGE(“date_completed”,“1/1/2012”)
.isLE(“date_completed”,“4/1/2012”)
.list(asQuery=true);

throws this:

An Unhandled Exception Occurred

An unhandled exception has occurred. Please look at the diagnostic information below:
Type java.lang.ClassCastException
Message java.lang.String cannot be cast to java.util.Date
Detail

Extended Info

Message java.lang.String cannot be cast to java.util.Date
Tag Context C:\inetpub\Frameworks\coldbox\coldbox_3_5\system\orm\hibernate\CriteriaBuilder.cfc (161)

this works:

var summaries = getSummaryService().newCriteria()
.isIn(“insco”,arguments.inscoCodes)
.isGE(“date_completed”,parseDateTime(“1/1/2012”))
.isLE(“date_completed”,parseDateTime(“4/1/2012”))
.list(asQuery=true);

Yea, unfortunately, almost all operations via criteria builders might need casting depending on the db datatype and that fluctuates per database, so it would be your job to send in the right casts, unless we can grow the criteria builder and make it smarter, thoughts?

Luis F. Majano
CEO
Ortus Solutions, Corp
www.ortussolutions.com

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Social: twitter.com/lmajano facebook.com/lmajano

i say make it smarter. perhaps introspect the column’s datatype and cast the value accordingly.

ill take a peak and see whats up.