Service methods are transactional by default. This is the easiest way to get transactional behavior in grails:
class SomethingService {
def doSomething() {
// transactional stuff here
}
}
If you need finer grained control than this, you can start and end transactions programmatically through hibernate:
class CustomTransactions {
def sessionFactory
def doSomething() {
def tx
try {
tx = sessionFactory.currentSession.beginTransaction()
// transactional stuff here
} finally {
tx.commit()
}
}
}