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

Statement getGeneratedKeys #82

Closed
bosborn opened this issue Sep 13, 2023 · 6 comments
Closed

Statement getGeneratedKeys #82

bosborn opened this issue Sep 13, 2023 · 6 comments

Comments

@bosborn
Copy link

bosborn commented Sep 13, 2023

xerial SQLite JDBC has removed Statement#getGeneratedKeys support in release 3.43.0.0.

Issue: xerial/sqlite-jdbc#329
Commit: xerial/sqlite-jdbc@712a8a5
Discussion: xerial/sqlite-jdbc#959

Would it be possible to replace getGeneratedKeys usage with a RETURNING clause? I did something similar in our library here: ngageoint/geopackage-java@f1579b94f9

ResultSet resultSet = stmt.getGeneratedKeys();

expect(prepStmt.getGeneratedKeys()).andReturn(resultSet);

@bosborn
Copy link
Author

bosborn commented Sep 13, 2023

Probably the same issue as j256/ormlite-core#288

@bosborn
Copy link
Author

bosborn commented Jan 10, 2024

Might be resolved by this pull request: xerial/sqlite-jdbc#1035

@Phoenix616
Copy link

PR was merged and 3.45.0.0 with it released.

@bosborn
Copy link
Author

bosborn commented Jan 19, 2024

Version 3.45.0.0 is working for my tests. The fix is to avoid xerial SQLite JDBC versions 3.43.0.0 through 3.44.1.0 (upgrade from 3.42.0.1 or before to 3.45.0.0 or later).

@bosborn bosborn closed this as completed Jan 19, 2024
@j256
Copy link
Owner

j256 commented Jan 26, 2024

Anything that ormlite should be doing here? Should I detect the support for get generated-keys and generate different SQL somehow using sqlite_version() or something?

@Phoenix616
Copy link

Ideally DatabaseMetaData#supportsGetGeneratedKeys() would be checked and different code be used if that returns false. For SQLite the issue was fixed in the mentioned Xerial SQLite JDBC driver update so it's not that urgent anymore to adjust in ORMLite but it could be helpful for people trying to use ORMLite with a JDBC driver that doesn't support it.

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

No branches or pull requests

3 participants