Spring, Hibernate and Ehcache - Wrong entities
I've got a webapp which uses spring+hibernate for my data layer. I'm using 2nd level caching with ehcache as provider. Everything seems to work so far but sometimes we encounter a problem which I can't really figure out atm.
One of my tables is used for labels within the application - every user who logs access this table with his set lan开发者_JAVA技巧guage. Works for 90% of the time. But sometimes the user gets labels for the wrong language, e.g. instead of german everything turns to italian.
After a logout and login all labels are correct.
Does anyone of you encountered something like this? I'm not sure where to look at: spring+hibernate+ehcache is a solid package or is it not?
Cheers
Spring/Hibernate/EhCache is a solid stack, I'm 99% sure it's a bug in your code.
Any chance the labels are cached statically somewhere in your application?
Make sure equals and hashcode are proprerly implemented in your entity classes, you can find insights on how to do it here
Try to remote debug your server, set breakpoints in your DAOs to check that the data is actually fetched.
精彩评论