Grails, GPars and data persistence

℡╲_俬逩灬. 提交于 2019-12-05 01:23:45

Gpars is a multi-threaded tool and the hibernate session injected in your domain class isn't thread-safe.

Try using these methods or invoking SessionFactory directly:

  • withNewSession
  • withNewTransaction

Beware that opening a session for each thread can be extremely costly and might flood your database with new connections.

I recently have a similar problem. As I understood, it seems to be that the threads could not bind the hibernate session, I can't get it to work either. If you don't really need it, try to write code dealing with persistence out of GPars. That is the way I get it to work.

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