NIKhil k
NIKhil k

Reputation: 1

Calling Postgresql function from java using JDBI Annotation

I am trying to call PostgreSQL function from Java but I am getting @sqlcall methods may only return null or Outparameters at present

This Function return list with same id.

    CREATE FUNCTION get_student(id IN INT) AS $$
    BEGIN
      return query
      select * from student 
      where student_id=id;
      END;
    $$ LANGUAGE plpgsql

java JDBI3 class

        @SqlCall("{:result = call get_student(:studentId)}")
        @OutParameter(name="result",sqlType=Types.JAVA_OBJECT)
        OutParameters getStudents(@Bind("studentId") int id);

There could be duplicate students and I am trying to get all the students with same id. I get this error "@sqlcall methods may only return null or Outparameters at present".

I tried using @sqlQuery but still facing the same issue.

Upvotes: 0

Views: 60

Answers (0)

Related Questions