possible non-threadsafe access to the session

Jhacher 2015-07-15 12:18:02
为什么会报这个错误?是什么意思
这是hql查询语句
select distinct f,iv from InventoryFlight iv,Flight f where iv.productId=f.id order by iv.useDate asc
inventoryFlight里有flight的id
...全文
127 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Jhacher 2015-07-15
引用 1 楼 rui888 的回复:
By stepping through the hibernate source code, I found out that the cause of the "possible nonthreadsafe access to session" error is that an AssetEntry instance is not found in the hibernate session context during a session flush, more specifically while an insert operation is being processed. What that means is that, under certain conditions, an AssetEntry object is inserted into the hibernate session context, then evicted later on before the session is flushed. Finally, when the session is flushed and the insert event is being processed, the AssetEntry object is no longer in the session context. From what I see, this is not an easily reproduceable problem due to the many factors involved, including: 1. The fact that BATCH mode is enabled for layout imports (see LayoutLocalServiceImpl.importLayouts()) 2. When an entity that was retrieved from cache gets deleted, and we are in batch mode, the entity gets evicted immediately from the hibernate session (see BatchSessionImpl.delete()) 3. When the JDBC batch limit is reached (default 20), the session gets flushed. 4. An AssetEntry is deleted every time an DLFileEntry workflow status is updated (the "draft" version). Like I said earlier, I have not yet identified the exact conditions that lead to the AssetEntry being evicted from the hibernate session too soon, but I wanted to share what I found and maybe someone else can shed more light on the problem. I will continue looking into it and update when I have more info.
是妹子吗?英语渣的我看不懂啊
回复
兔子托尼啊 2015-07-15
By stepping through the hibernate source code, I found out that the cause of the "possible nonthreadsafe access to session" error is that an AssetEntry instance is not found in the hibernate session context during a session flush, more specifically while an insert operation is being processed. What that means is that, under certain conditions, an AssetEntry object is inserted into the hibernate session context, then evicted later on before the session is flushed. Finally, when the session is flushed and the insert event is being processed, the AssetEntry object is no longer in the session context. From what I see, this is not an easily reproduceable problem due to the many factors involved, including: 1. The fact that BATCH mode is enabled for layout imports (see LayoutLocalServiceImpl.importLayouts()) 2. When an entity that was retrieved from cache gets deleted, and we are in batch mode, the entity gets evicted immediately from the hibernate session (see BatchSessionImpl.delete()) 3. When the JDBC batch limit is reached (default 20), the session gets flushed. 4. An AssetEntry is deleted every time an DLFileEntry workflow status is updated (the "draft" version). Like I said earlier, I have not yet identified the exact conditions that lead to the AssetEntry being evicted from the hibernate session too soon, but I wanted to share what I found and maybe someone else can shed more light on the problem. I will continue looking into it and update when I have more info.
回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-07-15 12:18
社区公告
暂无公告