class A {
def afterLoad() {
A.withTransaction {
}
}
}
在大多数情况下,它都有效,直到我在 Controller 中调用下面的列表
A.createCriteria().list{.....}
将抛出异常:org.hibernate.HibernateException:找到相同集合的两个表示形式
如果我删除
A.withTransaction
然后它将起作用。
最佳答案
也许
A.withNewSession { session ->
....
}
会帮助你
关于hibernate - GORM,获取org.hibernate.HibernateException:在afterLoad()中打开事务时找到同一集合的两个表示形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8221384/