0
와 저장 함수를 호출 나는 PostgreSQL을에 다음과 같은 유형이 : 나는에서 SimpleJdbcCall를 사용하기 위해 노력하고있어봄 - 복잡한 결과
CREATE OR REPLACE FUNCTION test_function(id int)
RETURNS TR_PERSON
AS $$
SELECT $1, text('Alice')
$$ LANGUAGE SQL;
: 내 타입을 반환
CREATE TYPE TR_PERSON AS (
i_out integer,
str_out text
);
또한 내가 저장 한 기능을 봄은 DB에서 데이터를 얻을 수 있습니다 :
:SimpleJdbcCall call = new SimpleJdbcCall(jdbcTemplate)
.withFunctionName("test_function");
SqlParameterSource in = new MapSqlParameterSource().addValue("id", 1);
try {
TRPerson result = call.executeFunction(TRPerson.class, in);
} catch (DataAccessException e) {
logger.log(Level.SEVERE, "call failed", e);
}
가 그럼 난 예외를 얻었다
SEVERE: call failed
org.springframework.dao.InvalidDataAccessApiUsageException: Required input parameter 'i_out' is missing
at org.springframework.jdbc.core.CallableStatementCreatorFactory$CallableStatementCreatorImpl.createCallableStatement(CallableStatementCreatorFactory.java:209)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:1014)
at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:1070)
at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:387)
at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:350)
at org.springframework.jdbc.core.simple.SimpleJdbcCall.executeFunction(SimpleJdbcCall.java:154)
왜 i_out이 입력 유형으로 표시되는지 이해할 수 없습니다. 내가 뭘 잘못하고있어?
내 요구에 맞는 SimpleJdbcCall이 맞습니까?
저장된 함수와 복합 형 결과를 사용하는 것이 가장 좋습니다.
나는 파이프 라인을 잡는 데있어 일부 골격 코드를 높이 평가할 것이다.