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

ResultSetExtractor can not use default row mapper [DATAJDBC-620] #840

spring-projects-issues opened this issue Oct 22, 2020 · 1 comment
in: repository type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Oct 22, 2020

denniseffing opened DATAJDBC-620 and commented

A CustomResultSetExtractor should either be instantiated using a constructor with a RowMapper parameter OR using a constructor without any parameters if the RowMapper-constructor doesn't exist:

This functionality is tested using the following unit test:

The issue is that the executor of the StringBasedJdbcQuery is initialized using a rowMapper set to null if the rowMapper equals the defaultRowMapper:

public StringBasedJdbcQuery(JdbcQueryMethod queryMethod, NamedParameterJdbcOperations operations,
		@Nullable RowMapper<?> defaultRowMapper, JdbcConverter converter) {

	super(queryMethod, operations, defaultRowMapper);

	this.queryMethod = queryMethod;
	this.converter = converter;

	executor = Lazy.of(() -> {
		RowMapper<Object> rowMapper = determineRowMapper(defaultRowMapper);
		return getQueryExecution( //
			queryMethod, //
			determineResultSetExtractor(rowMapper != defaultRowMapper ? rowMapper : null), //
			rowMapper //

This does not make sense at all, because the above mentioned RowMapper-constructor is only called it if exists anyways. This prevents injecting the default RowMapper into a custom ResultSetExtractor entirely. It will always be set to null

Affects: 2.0.4 (Neumann SR4), 2.0.5 (Neumann SR5), 2.1 RC2 (2020.0.0), 2.1 GA (2020.0.0)

Referenced from: pull request #256

@spring-projects-issues spring-projects-issues added type: bug in: repository labels Dec 31, 2020
@mp911de mp911de assigned mp911de and unassigned christophstrobl Jan 18, 2021
@mp911de mp911de added this to the 2.1.4 (2020.0.4) milestone Jan 18, 2021
Copy link

@mp911de mp911de commented Jan 18, 2021

Fixed via #256.

@mp911de mp911de closed this as completed Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: repository type: bug
None yet

No branches or pull requests

3 participants