title: Trying to catch ehcache Element ClassCastException
body: <p>I'm having trouble with ehcache trying to cache a table which is bigger than the storage I set to it. Although the application do not fail (because it end up performing the query in the database and returning the data) my log is getting full of ClassCastException.</p>
  
  <p>I don't want to change the settings because it will happen again, I'd like to catch the ClassCastException but it did not work. (I tried filtering the exception with a seam component and at a specific point where the exception is thown)</p>
  
  <p>Versions are: Seam 2.2.2, Hibernate 3.3.3 and ehCache 1.5</p>
  
  <pre><code>ERROR [user:] [DiskStore.java/get] – com.milestone.model.PersonItemCache: 
  Could not read disk store element for key com.milestone.model.PersonItem#438480. 
  Error was net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element
  java.lang.ClassCastException: net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element
  at net.sf.ehcache.store.DiskStore.loadElementFromDiskElement(DiskStore.java:302)
  at net.sf.ehcache.store.DiskStore.get(DiskStore.java:257)
  at net.sf.ehcache.Cache.searchInDiskStore(Cache.java:1202)
  at net.sf.ehcache.Cache.get(Cache.java:803)
  at org.hibernate.cache.EhCache.get(EhCache.java:80)
  at org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:178)
  at org.hibernate.cache.impl.bridge.EntityAccessStrategyAdapter.putFromLoad(EntityAccessStrategyAdapter.java:68)
  at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:179)
  at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877)
  at org.hibernate.loader.Loader.doQuery(Loader.java:752)
  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
  at org.hibernate.loader.Loader.loadCollection(Loader.java:2019)
  at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59)
  at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587)
  at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
  at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1744)
  at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
  at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
  at org.hibernate.collection.AbstractPersistentCollection.readElementExistence(AbstractPersistentCollection.java:164)
  at org.hibernate.collection.PersistentBag.contains(PersistentBag.java:262)
  at com.milestone.person.PersonItemController.addAsFans(PersonItemController.java:141)
  </code></pre>