Example usage for org.springframework.jdbc.core.namedparam BeanPropertySqlParameterSource registerSqlType

List of usage examples for org.springframework.jdbc.core.namedparam BeanPropertySqlParameterSource registerSqlType

Introduction

In this page you can find the example usage for org.springframework.jdbc.core.namedparam BeanPropertySqlParameterSource registerSqlType.

Prototype

public void registerSqlType(String paramName, int sqlType) 

Source Link

Document

Register a SQL type for the given parameter.

Usage

From source file:org.openlmis.performancetesting.dao.RequisitionDAO.java

public long insertRequisition(Rnr rnr) {
    GeneratedKeyHolder keyHolder = new GeneratedKeyHolder();
    BeanPropertySqlParameterSource paramSource = new BeanPropertySqlParameterSource(rnr);
    paramSource.registerSqlType("status", VARCHAR);
    template.update(insertRequisitionQuery, paramSource, keyHolder, new String[] { "id" });

    long id = keyHolder.getKey().longValue();
    rnr.setId(id);//from   ww w  .  ja  va 2  s . c o m

    logger.debug("{} requisition {} ", new Date(), id);
    return id;
}