@Override publicvoidsetParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType)throws SQLException { if (parameter == null) { if (jdbcType == null) { thrownew TypeException("JDBC requires that the JdbcType must be specified for all nullable parameters."); } try { ps.setNull(i, jdbcType.TYPE_CODE); } catch (SQLException e) { thrownew TypeException("Error setting null for parameter #" + i + " with JdbcType " + jdbcType + " . " + "Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. " + "Cause: " + e, e); } } else { try { setNonNullParameter(ps, i, parameter, jdbcType); } catch (Exception e) { thrownew TypeException("Error setting non null for parameter #" + i + " with JdbcType " + jdbcType + " . " + "Try setting a different JdbcType for this parameter or a different configuration property. " + "Cause: " + e, e); } } }
@Override public T getResult(ResultSet rs, String columnName)throws SQLException { try { return getNullableResult(rs, columnName); } catch (Exception e) { thrownew ResultMapException("Error attempting to get column '" + columnName + "' from result set. Cause: " + e, e); } }
@Override public T getResult(ResultSet rs, int columnIndex)throws SQLException { try { return getNullableResult(rs, columnIndex); } catch (Exception e) { thrownew ResultMapException("Error attempting to get column #" + columnIndex + " from result set. Cause: " + e, e); } }
@Override public T getResult(CallableStatement cs, int columnIndex)throws SQLException { try { return getNullableResult(cs, columnIndex); } catch (Exception e) { thrownew ResultMapException("Error attempting to get column #" + columnIndex + " from callable statement. Cause: " + e, e); } }
publicabstractvoidsetNonNullParameter(PreparedStatement ps, int i, T parameter, JdbcType jdbcType)throws SQLException;
publicabstract T getNullableResult(ResultSet rs, String columnName)throws SQLException;
publicabstract T getNullableResult(ResultSet rs, int columnIndex)throws SQLException;
publicabstract T getNullableResult(CallableStatement cs, int columnIndex)throws SQLException;