Hi Mybtais Team,

I am using mybatis for generic implementation of CRUD operation through out application and it was working fine with Spring boot 2.1.1.RELEASE and mybatis-spring-boot-starter:2.1.0 however when i upgraded version to Spring boot 2.2.1.RELEASE and mybatis-spring-boot-starter.2.1.1 version it started failing.

What i mean by failing is if i store java.lang.Integer as value in Map then while saving its getting converted into String and getting exception like - org.postgresql.util.PSQLException: ERROR: column "column_name" is of type numeric but expression is of type character varying.

Mapper Class

@Mapper
public interface GenericMapper {

  public void add(@Param("tablename") String tablename, @Param("fieldMap") Map<String, Object> fieldMap);

}

Mapper XML

<insert id="add" >
        INSERT INTO ${tablename}

        <foreach item="item" index="key"
            collection="fieldMap.entrySet()" open=" (" separator="," close=") " >
            ${key}
        </foreach>

        VALUES

        <foreach item="item" index="index"
            collection="fieldMap.entrySet()" open=" (" separator="," close=")">
            #{item}
        </foreach>
    </insert>

Any Suggestion will be highly be appreciated.

Comment From: harawata

Hello @gautamkct ,

Could you provide a small project replicating the issue? We may need to see everything including configuration, DB schema, etc.. Here are project templates to start with if it helps.

Comment From: kazuki43zoo

~~Could you try again to change as follow:~~

~~ ${key} -> ${item.key}~~ ~~ #{item} -> #{item.value}~~

Comment From: harawata

No response.