Grails named queries
I started to write a simple nam开发者_Go百科ed query in Grails, but it says missing method on the domain for the named query. Am I doing something wrong? I referred the documentation and found no problem with the code. Any help?
I just tried the example in the documentation.
class Publication {
String title
String author
Date datePublished
Integer numberOfPages
static namedQueries = {
recentPublications {
def now = new Date()
gt 'datePublished', now - 365
}
}
}
invoked the named query like
Publication.recentPublications()
It was complaining that the method recent publication was missing. I am using grails 1.3.1
try:
Publication.recentPublications.list()
instead of:
Publication.recentPlublications()
精彩评论