我正在使用spring,并且正在这样调用一个postgresql函数:
@Override
public List<JsonNodeBinaryType> getJsonInfo(String d_id, HttpHeaders headers) {
StoredProcedureQuery query = entityManager
.createStoredProcedureQuery("customer_orders.customer")
.registerStoredProcedureParameter(1,
JsonNodeBinaryType.class, ParameterMode.OUT)
.registerStoredProcedureParameter(2,
String.class, ParameterMode.IN)
.setParameter(2, d_id);
return query.getResultList();
}
这是我的postgres函数:
RETURNS jsonb
LANGUAGE plpgsql
AS $function$
declare
found_test jsonb;
begin
select o.info->'order'->0->'customerInfo' into found_test
from customer_orders.order_json o
where o.order_id = d_id;
return found_test;
end
$function$
;
这是我的控制台日志: 休眠:{call customer_orders.customer(?,?)}
我的回应:
{
"status": 404,
"message": "Customer order payments: null not Found",
"details": "uri=/customerOrders/5079345847/j"
}
我希望返回一个JSONB的客户信息。我在做什么错了?