Hi all,
I am having some trouble when loading entity's from the second level cache. My setup is as follows: I use Memcached as a second level cache provider for hibernate. For those of you that don't know memcached, it is a standalone caching server. The reason I use this is because the cache won't have to be recreated after a server restart. When I use the application for the first time there are no troubles with this and everything works fine. If I shutdown my tomcat server and then reboot it, then there are problems with reassembling entitys from the second level cache.
My guess is that the problem is caused because a new SessionFactory is created after rebooting my server, and the new session factory read the class properties in a different way. This explains why I get classCastExceptions from hibernate.
Now to get to my point, I wanted to know if there is a work around for this? Or is it impossible to do with a second level cache? Worst case scenario I have to evict my second level cache whenever the server restarts. But it would surprise me if the sessionfactory really reads in the properties in a random way.
Thank you for any help, Bas
|