LocalDateTime通过StoredProcedureQuery变成bytea

时间:2018-07-10 08:52:06

标签: java spring timestamp bytea

使用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.

0 个答案:

没有答案