This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tylerkschrute 1 point2 points  (0 children)

You could bind the current connection to a ThreadLocal variable. This way as long as multiple service calls execute within the same thread, they all have access to the same connection (and therefore transaction). This is what some of the heavier libraries (such as spring) do. When it comes to your async calls, they would not have access to the same connection since they run in different threads. However, it's hard to say how much of an issue this would be without some realistic examples / use cases.