3

私はこのようなSQLを持っています

<select id="getData" parameterType="map" resultMap="dataMapper">
  SELECT name FROM TABLE
</select>

このようなresultMap

<resultMap id="dataMapper" type="String">
    <result property="data" column="name" typeHandler="xxx.NameTypeHandler" />
</resultMap>

NameTypeHandler

public class NameTypeHandler implements TypeHandler<String> {

  @Override
  public void setParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException {
    // TODO Auto-generated method stub
  }

  @Override
  public String getResult(ResultSet rs, String columnName) throws SQLException {
    return "test" + rs.getString(columnName);
  }

  @Override
  public String getResult(ResultSet rs, int columnIndex) throws SQLException {
    return "test" + rs.getString(columnIndex);
  }

  @Override
  public String getResult(CallableStatement cs, int columnIndex) throws SQLException {
    return "test" + cs.getString(columnIndex);
  }
}

しかし、ハンドラーでは決して機能しません

私はこのように使用できますか?

4

0 に答える 0