Wednesday, May 25, 2016

Grails create read only service

Full read only service


package com.pkm.services.common

import org.springframework.transaction.annotation.Transactional

@Transactional(readOnly = true)
class DataReadService {
    def a() {

    }

    def b() {

    }
}

Some methods (method a) are read only, others are transactional


package com.pkm.services.common

import org.springframework.transaction.annotation.Transactional

@Transactional
class DataReadService {
    @Transactional(readOnly = true)
    def a() {

    }

    def b() {

    }
}

No comments:

Post a Comment