6

休眠 3.3.x、ehcache 2.2.x

当我尝试一次发布大量用户时,会发生以下错误。关于为什么会发生这种情况以及如何纠正这个问题的任何想法?有没有办法在批量加载用户之前禁用此缓存,如果是这样,我应该怎么做?

17:17:50,140 WARN [AbstractReadWriteEhcacheAccessStrategy] Cache
persistence.unit:unitName=my.ear/my-ejb-1.0.0.jar#my.com.mycompany.User.phones Key com.mycompany.User.phones#9915 Lockable : null

A soft-locked cache entry was expired by the underlying Ehcache.
If this happens regularly you should consider increasing the cache timeouts and/or capacity limits

编辑1:

当我尝试通过 JPA 调用将大量用户批量加载到数据库中时,会发生此错误。我不会通过拆卸钩子关闭缓存管理器。

4

3 回答 3

2

从描述来看,您的实体的二级缓存似乎已满,其中一些实体过早地从底层 ehcache 中逐出。如文档flush中所述,您是否在批量插入期间定期clear休眠?Session

于 2011-05-06T06:38:29.773 回答
1

您可能还想看看使用无状态会话。如果没有,正如@Binil Thomas 提到的那样,您将不得不flushclear您的会话来释放资源。

于 2011-05-09T19:40:40.693 回答
0

将 maxElementsInMemory 增加到 0。有关更多参考,请参阅此

于 2011-05-09T08:30:59.707 回答