I am trying to run a grails query which is as follows
select * from table where col1 like 'abc%' or col2 like 'abc%'
When I run DomainClass.executeQuery
it fails with the error table_name not mapped. I dont know how to write it in createCriteria. Can you please provide some guidance?
If you want to use criteria:
def c = Table.createCriteria()
def results = c.list {
or {
like("col1", "abc%")
like("col2", "abc%")
}
}
http://grails.github.io/grails-doc/3.0.x/ref/Domain%20Classes/createCriteria.html