我正在使用spring JdbcTemplate。我有这样的查询选择顶部? *从表,我设置的值?来自这样的调用方法:
jdbcTemplate.query(new PreparedStatementCreator() {
@Override
public PreparedStatement createPreparedStatement(final Connection connection) throws SQLException {
return connection
.prepareStatement(**select top ? * from table**);
}
}, new PreparedStatementSetter() {
@Override
public void setValues(final PreparedStatement ps) throws SQLException {
ps.setLong(1, 5);
}
},
new ResultSetExtractor<Object>() {
@Override
public List<Object> extractData(final ResultSet rs) throws SQLException {
final List<Object> objects = Lists.newArrayList();
//assume there is correct code
return objects;
}
});
但是这给我一个BadSqlGrammerException:@PO附近的语法不正确。
感谢帮助!!