引用查询模糊不清(jdbcTemplate)。

huangapple go评论45阅读模式
英文:

reference to query is ambiguous (jdbcTemplate)

问题

错误:对query的引用不明确
jdbcTemplate.query("select id from ( " +
^
query(String,ResultSetExtractor,Object...)方法和query(String,RowCallbackHandler,Object...)方法都匹配
其中T是一个类型变量:
T扩展自方法query(String,ResultSetExtractor,Object...)中声明的Object

同样的错误点:

错误:不兼容的类型:无法推断类型变量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.

huangapple
  • 本文由 发表于 2023年2月6日 18:19:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/75360000.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定