Hibernate 追随者和痛苦:非法尝试将集合与两个开放会话相关联
我正在开发一个游戏项目,我需要每 10 分钟对玩家进行排名,这很简单!股票游戏。 为了更新玩家排名,我每 10 分钟运行一个线程,该线程获取每个玩家对象(名为玩家),计算其得分,然后移动到下一个玩家,顺便说一下,我将玩家得分存储在它自己的对象中(玩家)。
但我认为这不应该是原因,因为如果更新发生在事务块内,MySql 会保证数据的准确性,那么 hibernate 为什么要限制此功能呢?
我不知道这是否是一个并发问题,是否与我所说的场景有关。 还有一件事是我没有使用 c3p0!与休眠一起,我不知道这是否相关,我只是想提一下。
谢谢转发,
i am working on a game project, where i need to rank players every 10 minutes, it is a simple! stock games.
in order to update player ranks, i run a thread every 10 minutes , the thread fetch every player object(named player), calculates its score and then move on to next player and by the way i am storing the players score in its own object(player).
but i think it shouldn't be the cause, because MySql guarantees the data accuracy if the updates come inside a transaction block, so why should hibernate restrict this feature?
i don't know if this is a concurrency issue and has anything to do with the scenario that i told.
and one thing else is i am not using c3p0! along with hibernate, i donno if this is related or not i just wanted to mention it.
thnx in forward,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论