Code example for PreparedStatement

Methods: setShort

0
    public void bindValue(PreparedStatement ps, int index, String value)
            throws SQLException { 
        if (value == null) {
            ps.setNull(index, Types.SMALLINT);
        } else { 
            ps.setShort(index, ShortConversionUtil.toPrimitiveShort(value));
        } 
    } 
 
    public String getValue(ResultSet resultSet, int index) throws SQLException {
        Object value = resultSet.getObject(index);
        return value != null ? StringConversionUtil.toString(value) : null;
    } 
 
}