views:

68

answers:

1

Hi there,

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 language. 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

+1  A: 

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.

Guillaume
Well, I'm using the dao class for this table as spring bean. So all lists and selects etc are generated on each request. Maybe some kind of old jsps which are given back here?
asrijaal
Good point. I overlooked my entity class, well all other have hashCodes and equals methods, this one not. I implemented them now. Maybe this did the trick.
asrijaal
These methods are critical for Hibernate, I suspect you're having hashcode collisions
Guillaume