Postgresql 如何在grails中使用withTransaction插入对象列表?
我使用GrailsDBM插件插入事务中的记录,这样我就不需要使用“flush:true”。 但不知怎的,它挂起了&没有前进。在没有使用“flush:true”的情况下,它可以正常工作 你能告诉我这个代码有什么问题吗Postgresql 如何在grails中使用withTransaction插入对象列表?,postgresql,grails,gorm,grails-2.0,grails-plugin,Postgresql,Grails,Gorm,Grails 2.0,Grails Plugin,我使用GrailsDBM插件插入事务中的记录,这样我就不需要使用“flush:true”。 但不知怎的,它挂起了&没有前进。在没有使用“flush:true”的情况下,它可以正常工作 你能告诉我这个代码有什么问题吗 grailsChange { change { def list1 = [record1,record2] list1.each {
grailsChange {
change {
def list1 = [record1,record2]
list1.each {
DomainClass.withTransaction{
new DomainClass(it).save(failOnError: true)
}
}
}
}
控制台日志显示
Starting dbm-update for database test @ jdbc:postgresql://localhost:5432/test
&不前进…&过了很长一段时间,我得到了这个异常
iquibase.exception.LockException: Could not acquire change log lock. Currently locked by ... since ....
我搜索了异常并在这里得到了答案