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

[MSSQL] Snapshot transaction isolation level cannot be used with inTransaction methods #2651

Open
mjadczak opened this issue Feb 23, 2024 · 1 comment
Labels

Comments

@mjadczak
Copy link

The Microsoft SQL Server JDBC driver defines a custom value for the SNAPSHOT transaction level which is unique to SQL Server.

Because the methods on JDBI and Handle objects which allow setting an isolation level, like inTransaction, require a parameter of type TransactionIsolationLevel, which is an enum defined directly by JDBI, this special value cannot be passed in, and we must instead set the default isolation level on the DataSource, or manually manage the handle's lifetime and use the setTransactionLevel override which allows specifying an int, neither of which are ideal.

Some immediate ideas for solutions are:

  • add an override for these methods which takes a raw int directly
  • change TransactionIsolationLevel to admit extension in some way - whether ad-hoc by the user, or by registering some sort of config or extension with the JDBI instance
@stevenschlansker
Copy link
Member

Thanks for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants