mybatis: latest

After I use mybaits-generator to generate dynamic-sql so it will use ProviderSqlSource, the parameterObject will always be xxxProvider;

When parsing sql with RawSqlSource, the ParameterMapping#JavaType will always be java.lang.Object;

I'm wondering if there is any way to make sure the ParameterMapping to get the proper type;

Because in the current scenario; if I register a JsonTypeHanlder like the following; the clazz here will become Java.lang.Object

public class JsonTypeHandler<T> extends BaseTypeHandler<T> {

    private final Class<T> clazz;

    public JsonTypeHandler(Class<T> clazz) {
        // Java.lang.Object
        this.clazz = clazz;
    }

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType) throws SQLException {    
    }
}

Comment From: jeffgbutler

The type handler will be calculated based on the type of the object in the parameter map - it won't be xxxProvider. But this sometimes fails, so it is best to explicitly set the type handler. The generator allows you to do this, and it will carry into the generated code.

In the generator configuration, do something like this:

<table tableName="some_table">
  <columnOverride column="some_column" typeHandler="foo.JsonTypeHandler"/>
</tableName>