Correct way to check if session is a transaction? #262
Unanswered
rubenferreira97
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Right now: yes. It is unlikely that it will change anytime soon. I'm curious though: why this pattern? Is there something that we should rather do at the package level that may serve you better? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Use case:
I am trying to implement a manual run-time "
@Transactional
" on the service layer. For this I need to check if a session is running in a transaction level. Look at the following POC:I am relying that this holds true for all transactions:
However this might be a problem in the future if this library creates something like
TxSession2
(which seems a silly example).To fix this issue some libraries expose a field like:
How should I check if a session is a transaction? Can I rely on
is TxSession
?Beta Was this translation helpful? Give feedback.
All reactions