I'm working with a project using GORM, without any Grails at all, and I'm having problems when I try to do a findByX. For instance, when I try a
Country.findByName("Canada")
The project does not compile, and it gives me
Error:(80, 9) Groovyc: [Static type checking] - Cannot find matching method app.domain.location.Country#findByName(java.lang.String). Please check if the declared type is right and if the method exists.
Even though the field Name exists.
I'm, however, able to, in CountryService.groovy, define a findByName method this way:
@Where({ name == countryName })
static Country findByName(String countryName){
Country.findAll().first()
}
But I don't think that's a good practice at all.
To summarize, Is there a dependency, a configuration, or something whatsoever I need in order to do GORM queries like Domain.findByX()? Or is it impossible using GORM standalone?
Thanks in advance.