MyBatis version

3.5.7

Database vendor and version

MySQL 8.0.25

Test case or example project

// User.java
public class User {
    private String id;
    private String name;
    private Integer age;
    private Map<String, Object> ext = new HashMap<>();
    private Role role;
}

// Role.java
public class Role {
    private String name;
}

// xml
<select id="select" resultType="x.y.User">
    select *,
           'role_admin' as `role.name`,
           'hello1' as `ext.hello1`,
           'hello2' as `ext.hello2`
    from user;
</select>

Steps to reproduce

@Test
public void select(){
    List<User> userList = userMapper.select();
    System.out.println(userList.size());
}

Expected result

the propery "ext" can correctly assigned with expected value like {"hello1"="hello1","hello2"="hello2"}

Actual result

{""="hello2"}

Snipaste_2021-08-25_22-56-42

Snipaste_2021-08-25_23-05-43

Snipaste_2021-08-25_23-02-45

Comment From: harawata

Hello @jinkun2014 ,

I didn't understand what you mean (images are not helpful. test case or demo project is), but this must be a duplicate of #13 . We fixed it in version 3.5.16, but you still have to write a custom map wrapper and factory. Please see the test attached to #3076 or my answer on the Stack Overflow.

Closing as duplicate.