Reputation: 65
After using the grails create-all command to generate a service interface, I would like to add some other methods that would require transactional scope for database updates. I'm made to understand that with grails 5 above, the ideal place to do it is in the services. But if I change the type from interface to class, seems like I need to implement all the other method calls, and if I continue to use interface, I can't add a body to the method. Haven't been able to find adequate reference for this yet to understand the full scope of what I need to do.
Thank you.
Upvotes: 0
Views: 114
Reputation: 169
I am obviously out of touch with the advancements in Grails (and/or SpringBoot in general). I had a very similar query, and finally found a post from Jeff Scott Brown that helped point me in the right direction.
In case anyone else finds this post before that one, I include my recap. Make an abstract base service, and let Spring Magic(TM) fill in all the parts you don't need to customize.
See the relevant docs: http://gorm.grails.org/latest/hibernate/manual/index.html#dataServices section: 10.1.4. Abstract Class Support
Cheers!
Upvotes: 1