1

使用 Java 8、Spring 4.3.9 和 Postgre 数据库。

我有一个定义如下的存储函数:

CREATE OR REPLACE FUNCTION public.getinformations (
  IN stateId integer,
  IN dateStart timestamp,
  IN dateEnd timestamp
)
  RETURNS SETOF DECLAREDTYPE
LANGUAGE plpgsql
AS $$ [...]

我想在 Spring 中调用它并使用 StoredProcedureQuery :

StoredProcedureQuery query = entityManager.createStoredProcedureQuery("public.getinformations ")
    .registerStoredProcedureParameter("stateId",Long.class,ParameterMode.IN)
    .registerStoredProcedureParameter("dateStart",LocalDateTime.class,ParameterMode.IN)
    .registerStoredProcedureParameter("dateEnd",LocalDateTime.class,ParameterMode.IN);

但是当获取该函数时,我收到以下错误:

ERROR: function public.getinformations (bigint, bytea, bytea) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
4

0 回答 0