How to properly call PostgreSQL functions (stored procedures) within Spring/Hibernate/JPA?

前端 未结 6 1327
孤城傲影
孤城傲影 2021-01-12 04:11

I\'m using Spring MVC 4, Hibernate and PostgreSQL 9.3 and have defined function (stored procedure) inside Postgres like this:

CREATE OR REPLACE FUNCTION spa.         


        
6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 04:28

    In case you are using also spring data, you could just define a procedure inside your @Repository interface like this,

    @Procedure(value = "spa.create_tenant")
    public void createTenantOrSomething(@Param("t_name") String tNameOrSomething);
    

    More in the docs.

提交回复
热议问题