You are correct, referring to outdated information. You can use domain classes inside classes defined in src/groovy .
The only downside: you have to handle transactions manually. Conversely, services inside grails-app/services passes the transaction by default. Services serve transactions if the transactional flag is set to true (by default, this value is not specified by anything).
On the other hand, when you access domain classes from src/groovy , you need to use the withTransaction block to process transactions manually.
Book.withTransaction{status-> def book = Book.findByTitle("Groovy in Action") book.title = "Grails in Action" book.save() status.setRollbackOnly() //Rolls back the transaction }
See withTransaction for details .
source share