Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/72.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.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 带空值的Spring JPA存储过程?_Java_Sql_Spring_Spring Data Jpa - Fatal编程技术网

Java 带空值的Spring JPA存储过程?

Java 带空值的Spring JPA存储过程?,java,sql,spring,spring-data-jpa,Java,Sql,Spring,Spring Data Jpa,我有一个存储过程,它是从JpaRepository实现中调用的 @Repository public interface DataMartRepo extends JpaRepository<DataMartDAO, String> { @Procedure(procedureName = "dbo.txn_ETL") public void txnETL( @Param("txId") String txId, @Param("in

我有一个存储过程,它是从JpaRepository实现中调用的

@Repository
public interface DataMartRepo extends JpaRepository<DataMartDAO, String> {

    @Procedure(procedureName = "dbo.txn_ETL")
    public void txnETL(
        @Param("txId") String txId,
        @Param("inId") String inId,
        @Param("proc") String proc,
        @Param("qtys") String qtys);

如何处理空值?将所有字符串设置为“”不会提供空插入。

看起来SP调用中具有空值的参数存在问题。请参见

以下是解决您的问题的可能方案:
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/Authenticator] 
threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: 
    Error calling CallableStatement.getMoreResults; nested exception is org.hibernate.exception.GenericJDBCException: 
    Error calling CallableStatement.getMoreResults] with root cause
com.microsoft.sqlserver.jdbc.SQLServerException: The value is not set for the parameter number 3.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildParamTypeDefinitions(SQLServerPreparedStatement.java:260)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.buildPreparedStrings(SQLServerPreparedStatement.java:219)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doPrepExec(SQLServerPreparedStatement.java:612)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:400)
[...]