Rolling back a transaction in a Grails Service
Posted
by UltraVi01
on Stack Overflow
See other posts from Stack Overflow
or by UltraVi01
Published on 2010-06-05T09:15:24Z
Indexed on
2010/06/05
9:22 UTC
Read the original article
Hit count: 251
I have been updating all my services to be transactional by using Grail's ability to rollback when a RuntimeException is thrown in the service. I have, in most cases, doing this:
def domain = new Domain(field: field)
if (!domain.save()) {
throw new RuntimeException()
}
Anyways, I wanted to verify that this indeed will rollback the transaction... it got me thinking as to whether at this point it's already been committed.. Also, if not, would setting flush:true change that? I am not very familiar with how Spring/Hibernate does all of this :)
© Stack Overflow or respective owner