Slackbot
10/16/2023, 6:59 PMGroovy Duke
10/17/2023, 11:25 AMDomain.withNewTransaction unless I had to and instead use the `@Transactional`(package varies between Grails versions) annotation from Grails, not Spring. @Transactional can be applied to the class level or the method level and does provide you some options that withNewTransaction doesn't:
https://docs.grails.org/latest/guide/services.html#declarativeTransactions
https://grails.github.io/grails2-doc/2.5.6/api/grails/transaction/Transactional.html
https://www.infoq.com/presentations/grails-transaction-2gx/
That being said you really shouldn't be writing new functionality on top of Grails 2.5.6, it's been EOL for over two years now, so you are putting yourself at risk for security issues. Upgrading from Grails 2.x to 3.x+ can be difficult depending on the size of your code base and how many bad practices you follow that are no longer supported. Some plugins are no longer valid and have become either gradle plugins, Grails features, or are just not supported because the original author stopped supporting it. Once past the Grails 3.x mark upgrades become a lot easier. At this point, I would upgrade to at least Grails 5.3.3 with a plan to upgrade to 6.0.x in the not-too-distant future.
Good luck.