controller - Grails 2.1 SQL to Grails GORM Query -
i want this
'select * mydomain enddate >= date , startdate <= date' please give possible solution way def date = new date().cleartime(), obj = mydomain.find(....................) or obj = mydomain.findwhere(....................)
but not want sql or hql injection. can me.i want gorm. apology bad english
the easiest way use criteria in case be
def mydomainlist = mydomain.withcriteria{ def date = new date().cleartime() le('startdate', date) ge('enddate', date) }
please note rectification: query demands less equals , greater equals, in case 'le' , 'ge' has used in criteria.
and implicit in criteria well.
Comments
Post a Comment