Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/371.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 方法groovy.sql.sql.callWithAllRows()的签名不适用于参数类型_Java_Sql_Groovy - Fatal编程技术网

Java 方法groovy.sql.sql.callWithAllRows()的签名不适用于参数类型

Java 方法groovy.sql.sql.callWithAllRows()的签名不适用于参数类型,java,sql,groovy,Java,Sql,Groovy,我通过groovy方法groovy.sql.sql.callWithAllRows调用一个sql存储过程,该方法不需要参数,只返回一个resultSet。但是,在发出以下方法时,由于“没有方法的签名:groovy.sql.sql.callWithAllRows()适用于参数类型”而失败,我假设您可以在不发送参数的情况下调用WithAllRows,因为存储过程不需要这些参数,这对吗 以下是失败的呼叫: List<List<GroovyRowResult>> resu

我通过groovy方法groovy.sql.sql.callWithAllRows调用一个sql存储过程,该方法不需要参数,只返回一个resultSet。但是,在发出以下方法时,由于“没有方法的签名:groovy.sql.sql.callWithAllRows()适用于参数类型”而失败,我假设您可以在不发送参数的情况下调用WithAllRows,因为存储过程不需要这些参数,这对吗

以下是失败的呼叫:

    List<List<GroovyRowResult>> results = sql.callWithAllRows("{call 
    myStoredProcedure()}",[],{});
    results.each { result ->
        result.each { row ->
            row.each {                   
                println(it.FormalName.toString())
            }
        }
    }
正确的语法是

def rowsList = sql.callWithAllRows '{call myStoredProcedure()}',[],{
    result ->
}

参考资料如下:

我将此标记为答案。这在我的开发系统w/Groovy 2.48上运行得很好,但在部署的系统w/Groovy 2.19中,它仍然会因为同样的错误而失败。有没有一种方法可以实现同样的技术,并通过如下sql.call{call mystoredprocesdure()},[],{result->}调用来检索resultSet/w。问题是在Groovy 2.1.9中,
调用(Gstring Gstring,List List,Closure Closure)
返回
void
。如果我没有错,
ResultSet
将作为
call
语法中的闭包变量
result
发送。可能是一个映射。我不知道resultSet是sql.call()附件的一部分。我将不得不在另一个问题中发表这篇文章,因为我不知道如何使用sql.call()本身。使用sql.callWithAllRows可以正常工作。但是,不幸的是,我必须使用部署在服务器上的groovy v2.19,它无法升级=)
def rowsList = sql.callWithAllRows '{call myStoredProcedure()}',[],{
    result ->
}