How to synchronize multiple clients with a shared database (JPA)?

杀马特。学长 韩版系。学妹 提交于 2019-12-07 01:03:30

It depends on whether you want the JPA provider to cache data or not. Without caching there's nothing to worry about, the data will be retrived from the database every time. With caching you will need some kind of distributed cache to ensure that clients don't have stale data. You haven't mentioned what JPA provider you are using. Eclipselink contains its own distributed cache implementation, but beware that you need to turn it on by setting a CacheSessionCustomizer. By default Eclipselink will cache the most recent 100 entities, so if you don't enable the distributed cache you're guaranteed stale data. With Hibernate you can use something like ehcache, but I haven't used that myself so can't really comment much on it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!