[英]Can I execute a plain SQL statement with the Spring JDBC template?
I am studying for the Spring Core certification and I have some doubts about the use of JdbcTemplate . 我正在学习Spring Core认证,我对JdbcTemplate的使用有些怀疑。 On the study material I found this question:
在研究材料上我发现了这个问题:
Can I execute a plain SQL statement with the JDBC template?
我可以使用JDBC模板执行纯SQL语句吗?
What exactly is a plain SQL statement ? 究竟什么是简单的SQL语句 ? Is it a standard SQL query?
它是标准的SQL查询吗? or what?
要不然是啥?
If it is a standard SQL query (not something like JPQL) I think that the answer is yes because I can do something like it: 如果它是标准的SQL查询(不是像JPQL那样),我认为答案是肯定的,因为我可以做类似的事情:
public Date getOldest() {
String sql = “select max(dob) from PERSON”;
return jdbcTemplate.queryForObject(sql, Date.class);
}
public long getPersonCount() {
String sql = “select count(*) from PERSON”;
return jdbcTemplate.queryForObject(sql, Long.class);
}
But I am absolutly not sure to have understand the sense of the question and what exactly represent a plain SQL statement . 但我绝对不确定理解问题的意义以及究竟代表一个简单的SQL语句 。
What do you think about? 你有什么想法?
From my point of view: 从我的角度来看:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.