Does Spring Data REST support JPA @Version?

冷暖自知 提交于 2019-12-05 04:02:40

I would say no, and that has not much to do with the use of Spring Data REST. You already mention you cannot set the version yourself as what happens then is undefined (I had this pleasant experience myself also). You basically have the same issue when posting normal form data and not storing the current version in the session (@SessionAttributes).

What we ended up doing was that we wrote a hibernate interceptor (would be a listener now I guess) which does the checking (so that we could actually set the version field). This worked without to much problems (but that was about 6 years ago), so Hibernate might have changed and could be acting differently now.

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