[Sharing transactions between threads]
Hello. I know that the documentation contains this message:
you should not try to share a transaction between multiple threads as it will lead to undefined behaviour.
, but we have one usecase where we need to share transactions between threads. We have GraphQL DataLoaders https://opensource.expediagroup.com/graphql-kotlin/docs/server/data-loader/. DataLoader can be executed inside another thread and we have to call database query inside it.
We solved the issue by using nested transactions and using wrapper on our code: