英文:
reference to query is ambiguous (jdbcTemplate)
问题
错误:对query的引用不明确
jdbcTemplate.query("select id from ( " +
^
其中T是一个类型变量:
T扩展自方法
同样的错误点:
错误:不兼容的类型:无法推断类型变量T
jdbcTemplate.query("select id from ( " +
^
(参数不匹配;lambda表达式中的返回类型错误
缺少返回值)
其中T是一个类型变量:
T扩展自方法query(String,ResultSetExtractor ,Object...)中声明的Object
Note: The code you provided is in Java, and it seems to be related to an ambiguous reference to the query
method of the JdbcTemplate
class, leading to a type inference error.
英文:
I cloned project from git and code is working on another machines.
just for me have errors, look at code and error:
And similar to this error is repeated in other places and other classes. I really have no idea.
I used different JDKs, different version of Gradle settings and tomcat settings correctly. The code runs on other computers, but not on my system.
@Override
public Long findLastPolicy(long policyId) {
Long firstPolicy = findFirstPolicy(policyId);
if (firstPolicy == null) {
return null;
}
final List<Long> lastPolicyId = new ArrayList<>();
jdbcTemplate.query("select id from ( " +
" select qsn3.fk_plc id from cmn.tbi_questionnaire_tree qsn3 where qsn3.fk_plc_anct = ? and qsn3.fk_plc is not null" +
" order by qsn3.endorsement_sequence desc " +
" ) where rowNum < 2", resultSet -> {
lastPolicyId.add(resultSet.getLong("id"));
}, firstPolicy);
return lastPolicyId.get(0);
}
> error: reference to query is ambiguous
jdbcTemplate.query("select id from ( " +
^
both method <T>query(String,ResultSetExtractor<T>,Object...) in JdbcTemplate and method query(String,RowCallbackHandler,Object...) in JdbcTemplate match
where T is a type-variable:
T extends Object declared in method <T>query(String,ResultSetExtractor<T>,Object...)
>
And at the same point:
> error: incompatible types: cannot infer type-variable(s) T
jdbcTemplate.query("select id from ( " +
^
(argument mismatch; bad return type in lambda expression
missing return value)
where T is a type-variable:
T extends Object declared in method <T>query(String,ResultSetExtractor<T>,Object...)
答案1
得分: 0
问题已解决。我删除了所有的JDK、Gradle、IDE以及与IDE相关的所有文件和文件夹,然后重新安装了它们。
英文:
Problem solved. I deleted all jdk's and gradle and ide and all file and folders about ide and reinstalled all of them again.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论