giangio
04/20/2024, 10:05 AMdef domain = grailsApplication.getArtefact('Domain', 'MyDomainClass')
Is there a way to do it? Am I in the wrong direction?mattias_reichel
04/21/2024, 11:53 AMclass Book {
String title
}
def domainClass = grailsApplication.getArtefact('Domain', 'Book').clazz
domainClass.withTransaction {
def book = domainClass.declaredConstructors[0].newInstance([title: 'Grails in Action'])
book.save()
book.list().each {
println it.title
}
}giangio
04/21/2024, 11:57 AMgiangio
04/22/2024, 8:49 AMlist() without creating a new instance of a Book. I still havent find a way, any suggestion?mattias_reichel
04/22/2024, 8:58 AMdef domainClass = grailsApplication.getArtefact('Domain', 'Book').clazz
domainClass.withTransaction {
domainClass.list().each {
println it.id
}
}giangio
04/22/2024, 4:15 PMlist() method on the class. I'm on Grails 6mattias_reichel
04/22/2024, 7:41 PM@CompileStatic . Have you tried without that?