`Type cannot be null` exception when trying to run out Stored Procedure using Spring Data JPA

后端 未结 4 1444
情书的邮戳
情书的邮戳 2021-01-28 18:07

I am trying to invoke a Stored Procedure whose signature looks like the following:

CREATE OR REPLACE PROCEDURE FIND_FIRST_BOOKMARK_GT(bookmark IN NUMBER, cur OUT         


        
4条回答
  •  北恋
    北恋 (楼主)
    2021-01-28 18:41

    This is an old question, but I faced with same issue and get fixed finally after a couple of hours of "read docs-try-error". Maybe this could be useful to someone. Your repository must look like this:

    @Repository
    public interface ResponseRepository extends CrudRepository{
        @Procedure(name = "Response.findFirstBookmarkGreaterThan")
        Response findFirstBookmarkGreaterThan(@Param("bookmark") Long bookmark);
    }
    

    The key is at @Procedure annotation. Use "name" instead of "value" (by default) when coding this annotation. This article at Baeldung blog gave me the final pull to resolve this error: https://www.baeldung.com/spring-data-jpa-stored-procedures.

提交回复
热议问题