简体   繁体   English

Spring,Hibernate和Ehcache-错误的实体

[英]Spring, Hibernate and Ehcache - Wrong entities

I've got a webapp which uses spring+hibernate for my data layer. 我有一个使用spring + hibernate作为数据层的webapp。 I'm using 2nd level caching with ehcache as provider. 我正在使用ehcache作为提供程序的二级缓存。 Everything seems to work so far but sometimes we encounter a problem which I can't really figure out atm. 到目前为止,一切似乎都正常,但是有时我们遇到一个我无法真正解决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. 90%的时间都可以工作。 But sometimes the user gets labels for the wrong language, eg 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? 我不确定在哪里看:spring + hibernate + ehcache是​​一个可靠的软件包,不是吗?

Cheers 干杯

Spring/Hibernate/EhCache is a solid stack, I'm 99% sure it's a bug in your code. Spring / Hibernate / EhCache是​​一个可靠的堆栈,我99%确信这是您代码中的错误。

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 确保在实体类中正确实现了equals和hashcode,您可以在此处找到有关如何执行的见解

Try to remote debug your server, set breakpoints in your DAOs to check that the data is actually fetched. 尝试远程调试服务器,在DAO中设置断点以检查数据是否已实际获取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM