I have two (in fact) domain classes, ClassA and ClassB, and must fulfill the same request on both
ClassA.where { a == b }.list()
and
ClassB.where { a == b }.list()
I want to write a service class to fulfill these requests passing a Class object instead of creating a service for each class. I tried this solution
def clazz = grailsApplication.getDomainClass(domainClass) clazz.where { a == b }.list()
but I have an exception telling me that DefaultGrailsDomainClass does not have a "where" method.
Is there any other way to do this? something like "ClassA.grailsClass.where {}"
thanks
source share