Skip to content

Conversation

@ddoaj97
Copy link

@ddoaj97 ddoaj97 commented Sep 6, 2018

When using a Mybatis Cursor the DefaultResultSetHandler would interact with the ResultSet after it was closed automatically by the DB2 driver when we reached the end, this causes SqlExceptions. This commit implements a workaround that checks if the result set is already closed.

I also added a unit test with a mocked ResultSet that replicates the behavior of DB2. With my fix the SQLException is avoided, whereas the old code triggers the exception.

It would be nice if someone with a better knowledge of the Mybatis code base could have a look and see if there are better ways to fix it. I'm under the impression that the code in DefaultResultSetHandler#handleRowValues was never intended to be called multiple times like the DefaultCursor does. Maybe the code in DefaultResultSetHandler would be better off being split into two implementations: a list-based handler and a iterator-based handler.

The DefaultResultSetHandler would interact with the ResultSet after it
was closed automatically when we reached the end, this causes
SqlExceptions. This commit implements a workaround that checks if the
result set is already closed.
@ddoaj97 ddoaj97 changed the title Workaround for an issue when using mybatis cursor on DB2 (fixes #1345) Fixes #1345 - Workaround for an issue when using mybatis cursor on DB2 Sep 6, 2018
@CNbhf

This comment has been minimized.

@pelmegov
Copy link

how often repository owners merge pull requests? why too many ones?

@harawata
Copy link
Member

#1345 was fixed via #1355

@harawata harawata closed this Sep 17, 2018
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

Successfully merging this pull request may close these issues.

4 participants