Answer the question
In order to leave comments, you need to log in
JdbcTemplate dynamic table name?
Greetings dear forum users.
Please tell me how to make it so that the name of the table can be passed in the parameters of the method argument? and then the question mark =? does not fit.
public String getFieldFromEntityWhereValue(String selectField, String fromEntity, String whereValue) {
String sql = "SELECT email=? FROM user WHERE token=?";
return jdbcTemplate.queryForObject(sql, new Object[] { selectField, fromEntity, whereValue}, String.class);
}
Answer the question
In order to leave comments, you need to log in
No way. And in any correct scenarios for using a relational database, this cannot be needed.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question