Skip to content

Using DataClassRowMapper causes "No property found for column" debug messages in logs  #28179

Closed
@petergphillips

Description

@petergphillips

Spring JDBC: 5.3.16
Spring Boot 2.6.4

We're experimenting with the new DataClassRowMapper and found that if logging is set to DEBUG level then the No property found for column debug message is output.

This is confusing as it suggests that the column / property isn't being mapped, which isn't true as it is mapped during the constructor injection instead.

Steps to reproduce:

  1. Change spring logging to be debug in the test log file.
  2. Run one of the tests - ./gradlew spring-jdbc:test --tests org.springframework.jdbc.core.KotlinDataClassRowMapperTests
  3. View the standard output from the test in spring-jdbc/build/reports/tests/test/classes/org.springframework.jdbc.core.KotlinDataClassRowMapperTests.html

e.g.

08:37:03.946 [Test worker] DEBUG o.s.j.c.JdbcTemplate - Executing SQL query [select name, age, birth_date, balance from people]
08:37:03.953 [Test worker] DEBUG o.s.j.d.DataSourceUtils - Fetching JDBC Connection from DataSource
08:37:03.973 [Test worker] DEBUG o.s.j.c.DataClassRowMapper - No property found for column 'name' mapped to field 'name'
08:37:03.973 [Test worker] DEBUG o.s.j.c.DataClassRowMapper - No property found for column 'age' mapped to field 'age'
08:37:03.974 [Test worker] DEBUG o.s.j.c.DataClassRowMapper - No property found for column 'birth_date' mapped to field 'birth_date'
08:37:03.974 [Test worker] DEBUG o.s.j.c.DataClassRowMapper - No property found for column 'balance' mapped to field 'balance'
08:37:03.975 [Test worker] DEBUG o.s.j.c.DataClassRowMapper - No property found for column 'e_mail' mapped to field 'e_mail'

The message should only be output if no property has been found / mapped.

In this case DataClassRowMapper deliberately suppresses the properties. One solution would be to keep a set of suppressed properties and then only output the message if not in the set.

Note that the log message is only output if logging is set to DEBUG, so it isn't a high severity issue.

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions