使用NamedParameterJdbcTemplate在SQL查询中将表名作为参数传递?

时间:2018-06-09 12:26:13

标签: java sql jdbctemplate

我正在执行一个简单的SQL查询="

i love dogs
i love dogs and cats
cats goods and i love dogs and birds
cats goods birds goods i love dogs

并使用namedParamterJdbcTemplate执行此查询。

现在我想让表名也像这样变量

select id, first_name, last_name, city
from customer where id = :id

我将使用HashMap传递表名和id。 但是我收到错误声明无效的sql语句?

0 个答案:

没有答案
相关问题