org.springframework.remoting.RemoteAccessException:
Cannot access remote service
[{http://127.0.0.1:8080/project/services/xxxxService}ocapService]; nested exception is org.apache.axis.AxisFault: org.springframework.dao.InvalidDataAccessApiUsageException:
Cannot execute [SQL sentence]
as a static query: it contains bind variables
原因:sql 语句带有问号,而问号没填充参数
举例:
String SQL = "SELECT count(*) FROM yourTable WHERE key=?";
jdbcTemplate.query(
SQL,
new PreparedStatementSetter() {
public void setValues(PreparedStatement ps) throws SQLException {
int i=1;
ps.setString(i++, bean.getKey() );
}
},
new RowCallbackHandler(){
public void processRow(ResultSet rs) throws SQLException {
ls.add( new Integer( rs.getInt(1) )) ;
}
}
);