jpa repository websocket @MessageMapping

时光总嘲笑我的痴心妄想 提交于 2019-12-11 03:56:38

问题


I found out, that spring does not create a transaction for websocket requests that are going to a action annotated with @MessageMapping. Even if i annotate the action as @Transactional nothing happens.

I also tried the way with an action that is @RequestMapping annotated. This works as usual.

Has someone an idea how i can make this work? How to make an websocket request transactional?


回答1:


You shoould show your code, because it really works, unless you have some async internal logic, which doesn fit for single-threaded transactional boundries.




回答2:


I fixed this issue by my self: I just had to rename my entity manager factory to entityManagerFactory... Thats it.



来源:https://stackoverflow.com/questions/25082234/jpa-repository-websocket-messagemapping

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