1

In case of select with named parameter query with like where qualifier ,we are using like below.

final String sqlQuery = "select  e.COMM,  e.DEPTNO,  e.EMPNO,  e.ENAME from EMP e where
 JOB like :JOB"
 Map namedParameters = new HashMap();
 namedParameters.put("JOB", "");
 List result = namedParameterJdbcTemplate.queryForList(sqlQuery, namedParameters);

How will be select with named parameter query with between where qualifier?

4

1 回答 1

1
final String sqlQuery =
    "SELECT e.id, e.name, e.salary, e.dept FROM emp e "
    + "WHERE e.salary BETWEEN ? AND ?";

如果您使用的是PreparedStatement示例:

pst.setLong(1,Long.parseLong(searchCriteria.getTransactionNo()));
pst.setLong(2,Long.parseLong(searchCriteria.getTransactionNo()));
于 2013-02-27T11:46:55.187 回答