I am looking to query the matching records based on input number(say 56). The type of the column in ORACLE DB is Long. Expecting all matching records has the numbers for ex - 156, 567, 12356..etc. Is it possible to write a named query in GRAILS for above ?. Is there any other way out ?
If you want to use database functions in your named queries, you can use the sqlRestriction
clause. Note that the syntax must match you table and not domain class, so considering:
class MyDomain {
Date myField
}
Your restriction can be:
def namedQueries = {
someQuery {
sqlRestriction("to_char(my_field, 'dd/mm/yyyy') = '25/07/2013'")
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.