问题
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