6

Hibernate 3.3.x, ehcache 2.2.x

The following error occurs, when I try to publish a lots of users in a single go. Any idea on why this would happen and how to rectify this? Is there a way to disable this cache prior to bulk loading of users, if so how should I do that?

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

EDIT1:

This error happens when I try to bulk load a lot of users into the database via JPA calls. I don't shutdown the cache manager via a tear down hook.

Joe
  • 14,513
  • 28
  • 82
  • 144

3 Answers3

2

From the description it looks like the second-level cache for your entities are getting full, and some of them are getting evicted from the underlying ehcache prematurely. Do you flush & clear the hibernate Session periodically during your bulk-insert, as mentioned in the documentation?

Binil Thomas
  • 13,699
  • 10
  • 57
  • 70
  • To test out the hypothesis, you can try set EhCache's `maxElementsInMemory` to 0 - so that no entry ever gets evicted - and check if the warning goes away. – Binil Thomas May 06 '11 at 16:43
1

You may also want to look at using a Stateless Session. If not, as @Binil Thomas mentioned, you're going to have to flush and clear your session to free up resources.

MarkOfHall
  • 3,334
  • 1
  • 26
  • 30
0

Increase maxElementsInMemory to 0. For more reference see this

Community
  • 1
  • 1
Rupeshit
  • 1,476
  • 1
  • 14
  • 23