Ability to get generated keys from execution of a prepared batch request #101
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Judging on the discussion from the user-group it seems as useful functionality.
As I am aware H2 doesn't support key generation in a batch (relevant issue), but HSQLDB does.
So I had to add the HSQLDB dependency to test this functionality. Anyway, it seems a better solution then trying to start a MySQL database in unit-tests, as Brian pointed in the discussion.
I don't really like the way I've implemented this feature. Specifically, returning Object from internalBatchExecute method and then suppressing a warning from a compiler, but couldn't figure out how to generalize execute method and don't create an another abstraction level. The code seems to be too coupled.
I've chose the in-memory database mode in tests, because we don't need keep states between tests and maintaining a database in the memory is a lot simpler than in the disk. As we don't need many HSQLDB tests here, I think it's justified.