重复输入保存-Grails

时间:2018-08-27 03:03:39

标签: hibernate grails

我知道该错误是在以下代码段中引起的,当我注释以仅保存分隔符时,它不会进行转换。当我首先保存会议,然后分离重复的enty错误时。

def separation = null
  separation = new Separation(
  expedicao: expedition,
  dateInit: new Date(),
  user: springSecurityService.currentUser,
  typePackage:dist.box,
  package:package
)    
try {
  Separation.withTransaction {
    separation.conference = new ConferenceQuantity()
    separation.conference.getList (listProducts.id)
    separation.conference.typeConference = true
    //separation.conference.save(flush: true, failOnError: true)
    separation.save (flush: true, failOnError: true)
  }
} catch (RuntimeException ex) {
  log.error "** Saving error: $ {separation} $ {separation.conference}"
  launch new RuntimeException ('Error creating partition')
}

有人知道如何停止给出此错误:

  

错误27-08-2018 00:11:54 [JDBCExceptionReporter]:重复的条目   密钥“ tenant_id”为“ 1-416834-1”

0 个答案:

没有答案