Grails GORM: could not initialize proxy - no Session

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 02:53:00

I don't think you are doing anything 'wrong', it is just that the object got detached from the hibernate session. A couple of things I'd try:

I had the same exact error when I was using sub domain classes into one class, if your data size is more than a page size, you would get the error "Message: could not initialize proxy - no Session"

By using <> lazy:false, hibernate will use the session attachment properly and will get the appropriate data displayed.

Thank you for this post. I was able to resolve my error.

Thomas Farvour pointed in the right direction. The docs, 13.1.1 Transactions Rollback and the Session, suggest eager-fetching the children as the optimal solution.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!