Grails-Hibernate Lock等待超时超出异常

时间:2014-11-26 20:25:37

标签: hibernate grails gorm

我在尝试保存作为域名对象的caseToTag对象时遇到异常的锁定错误。 该应用程序获取所有未标记的案例,尝试标记它调用method1-method3,修改付款,所以我们保存它然后当试图将案例保存在caseToTag.save(flush:true)时抛出该异常。 我使用的是Grails 2.2.4和Mysql 5.6.21 -

class TagService {

    static transactional = false

    def userService
    def mediationService
    def paymentService
    def utilsService

    def tagCases(){
        def casesToTag = PpCase.findAllByStatusAndStatusDetail(PpCase.Status.PENDING, PpCase.StatusDetail.TAG)
        log.info "Se tienen ${casesToTag.size()} casos para taguear."
        casesToTag.each{ caseToTag ->
            try {
                caseToTag.payments.each{ payment ->
                    tagPayment(payment)
                }
                caseToTag.status = PpCase.Status.PENDING
                caseToTag.statusDetail = PpCase.StatusDetail.SF_INIT
            }
            catch(TagException e) {}
            caseToTag.save(flush: true)
        }
    }

    def tagPayment(payment){
        try{
           mathod1(payment)
           mathod2(payment)
           mathod3(payment)
           payment.save(failOnError: true)
        }catch(Exception e){
            throw new TagException(e.getMessage())
        }
    }

0 个答案:

没有答案