Skip to content

Regression: Constructor args fails on record types #2840

Closed
@jdmichal

Description

@jdmichal

MyBatis version

3.5.11 via mybatis-spring-boot-starter 2.3.0

Regression from 3.5.9 via mybatis-spring-boot-starter 2.2.2

Database vendor and version

PostgreSQL 14.x

Test case or example project

public record ResultType(
    String value) {
}
<resultMap id="resultTypeMap" type="ResultType">
    <constructor>
        <arg column="value" name="value" />
    </constructor>
</resultMap>

<select id="getResult" resultMap="resultTypeMap">
    SELECT 'foobar' AS value;
</select>

Steps to reproduce

  1. Create a record type and map to it via a constructor resultMap, as above.

Expected result

The default record constructor would be found and linked.

Actual result

The default record constructor is not found due to the java type of the ResultMapping being java.lang.Object.

Workaround

Define the javaType for the constructor args. This was not necessary in version 3.5.9.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions