Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/361.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
Postgresql:使用Hibernate通过Java代码调用存储过程_Java_Postgresql_Hibernate_Stored Procedures - Fatal编程技术网

Postgresql:使用Hibernate通过Java代码调用存储过程

Postgresql:使用Hibernate通过Java代码调用存储过程,java,postgresql,hibernate,stored-procedures,Java,Postgresql,Hibernate,Stored Procedures,使用lambda表达式(->{)调用存储过程时出错 错误:org.postgresql.util.PSQLException:错误:在“{”处或附近出现语法错误 下面是我使用Prepared调用存储过程的代码 声明 我想执行此存储过程。请您建议更改或修改我的当前代码来帮助我 提前感谢。试试这个: public void deleteData(Session session, int minVal, int maxVal) throws SQLException { session.doW

使用lambda表达式(->{)调用存储过程时出错

错误:org.postgresql.util.PSQLException:错误:在“{”处或附近出现语法错误

下面是我使用Prepared调用存储过程的代码 声明

我想执行此存储过程。请您建议更改或修改我的当前代码来帮助我

提前感谢。

试试这个:

public void deleteData(Session session, int minVal, int maxVal) throws SQLException {
    session.doWork(new Work() {
                @Override
                public void execute(Connection connection) throws SQLException {
                    CallableStatement st = null;
                    st = connection.prepareCall("{call delete_data(?,?)}");
                    st.setInt(1, minVal);
                    st.setInt(2, maxVal);
                    st.execute();
                    st.close();
                }
            }); 

    }
public void deleteData(Session session, int minVal, int maxVal) throws SQLException {
    session.doWork(new Work() {
                @Override
                public void execute(Connection connection) throws SQLException {
                    CallableStatement st = null;
                    st = connection.prepareCall("{call delete_data(?,?)}");
                    st.setInt(1, minVal);
                    st.setInt(2, maxVal);
                    st.execute();
                    st.close();
                }
            }); 

    }