使用grails 3.3.8
如果在发出保存的服务方法中抛出了捕获的异常,则不会保存任何domainclass.save(flush:true,failOnError:true).即
try {
//some code that throws exception
} catch (Exception exception) {
print 'some message'
}
domainclass.save(flush:true,failOnError:true)
Run Code Online (Sandbox Code Playgroud)