Skip to content
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

Make org.springframework.jdbc.datasource.DataSourceTransactionManager extendable [SPR-17230] #21763

Closed
spring-projects-issues opened this issue Aug 31, 2018 · 3 comments

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Aug 31, 2018

Ken Rune Helland opened SPR-17230 and commented

Make org.springframework.jdbc.datasource.DataSourceTransactionManager extendable

I need to change how this class does begin, commit and rollback transaction due to a legacy sybase database (do "Begin transaction" rather than "Set chained mode on").
Ideally I should be able to extend the class and override doBegin(), doCommit() and doRollback(), but because the inner class DataSourceTransactionObject is private this is not possible.

Suggjested solution:
Make inner class DataSourceTransactionObject proteced so it is accessible for subclasses.


No further details from SPR-17230

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 31, 2018

Juergen Hoeller commented

DataSourceTransactionObject is intentionally private since it conceals some rather specific settings. For overriding purposes at doBegin/doCommit/doRollback level, could you cast the transaction object to its common supertype JdbcTransactionObjectSupport? This should be sufficient as long as you're not dealing with pre-bound non-transactional connection holders (which is very uncommon) or restoring an auto-commit setting.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 31, 2018

Ken Rune Helland commented

Juergen Hoeller:
Thank you for a quick reply.
Your suggestion worked, I now have a working transactionmanager subclassed from DataSourceTransactionManager.

Thank you very much.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Sep 2, 2018

Juergen Hoeller commented

Alright, good to hear that it works for you that way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.