Conversation
CallableStatement.execute() can return false when an update count precedes a ResultSet. Without a configured OUT cursor, the reader previously called getObject(0) and failed. Skip update counts to locate the first ResultSet while preserving function and OUT cursor handling. Restore the disabled stored procedure tests and add unit tests for result chain traversal and resource cleanup. Order procedure results by ID for deterministic reads and restarts. Signed-off-by: Hyunwoo Jung <hyunwoojung@kakao.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
StoredProcedureItemReaderfails duringopen()when a stored procedure returns an update count before its ResultSet and no REF CURSOR is configured.In
openCursor(), afalsereturn value fromCallableStatement.execute()is incorrectly treated as indicating an OUT cursor. However,falsecan also mean that the first result is an update count or that there are no results. WithrefCursorPositiondefaulting to0, the reader callsgetObject(0), causing initialization to fail.The HSQLDB procedures used by the tests reproduce this issue by returning an update count of
0before their ResultSet:Fix
Skip update counts to locate the first ResultSet in the JDBC result chain. Stop once the ResultSet is found so it remains available for the reader.
Preserve the existing handling of immediate ResultSets, function return values, and configured REF CURSOR parameters.
If the result chain ends without a ResultSet, close the resources and fail during
open()with a descriptive exception.Tests
Restore the disabled stored procedure tests by moving the procedures to a script declared with
separator="/", so the semicolons insideBEGIN ATOMICare no longer treated as script statement separators.Add unit tests for result chain traversal, missing results, resource cleanup, and existing cursor handling.