-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Enable transaction management for JdbcOperationsSessionRepository operations #464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@vpavic Thanks for the PR! I think I'd prefer to allow the user to create the transactional boundary by exposing a bean of a particular name.
What are your thoughts? |
@rwinch I see your point here - you'd prefer to take a less opinionated route on how to approach the transaction management within the I guess this makes sense, and it actually makes the job quite easier for us in terms of implementation as well as testing. Documentation should provide some concrete examples for this approach. Do you prefer to keep offer this only for write operations, or read ones as well? |
@vpavic Thanks for the fast reply. I'd say we should do transactions or reads also. |
4fd37e6
to
1cc474a
Compare
@rwinch I've updated the PR. Please share your thoughts. Documentation is still pending. |
I would still prefer using REQUIRES_NEW propagation behaviour as a sane default, because I would personally expect this to "just work" without extra configuration. My previous suggestion was to avoid introducing unnecessary configuration for the time being, but the behaviour on rollback is not quite the same with session persist after succesful commit. |
@kherrala @vpavic Thanks for your feedback. I've been doing some more thinking about this and I think you two have convinced me that my approach was not ideal. We should work out of the box, so I think you two are right that we should create the transactions by default. What's more is we can always make it optional later on and still remain passive. If we start without requiring it and it causes problems, we are stuck with this default to remain passive. @vpavic I'm sorry on flip-flopping on this, but hopefully getting to the "right answer" is some consultation. Do you mind updating the PR to take these changes into account. |
@rwinch I'm always in favor of thinking things through a bit more even at the expense of delaying things so 👍 on that from my side. No problems on updating the PR, I'll take care of that soon. Now that we've decided what the default behavior is, the question is what means do we provide for changing the defaults?
If I'm reading this correctly you wouldn't provide an option for users to disable transactions right now, but rather at some later stage if there's need for this? |
Glad to hear that :)
Awesome! Thanks :)
Correct |
1cc474a
to
4b49ab9
Compare
@rwinch I've updated the PR. |
Thanks for the PR! This is now merged into master |
This PR adds option to enable transactional execution of write operations in
JdbcOperationsSessionRepository
.Transactional execution is enabled by using
@EnableJdbcHttpSession(transactional = true)
and providingPlatformTransactionManager
or , in case of manual configuration, by settingPlatformTransactionManager
directly onJdbcOperationsSessionRepository
using appropriate setter method. Transactions will be executed using propagationREQUIRES_NEW
.This change fixes #446 and #459.
@rwinch please review. If you're OK with this approach I'll proceed to update the PR documentation updates.
I've signed the CLA.