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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -