在我的Spring Boot应用程序中,我有一个带有用户定义的type out参数的oracle存储过程。 当我使用以下代码调用该sp时,出现“ java.lang.IllegalArgumentException:类型不能为null”错误。
我应该如何处理这种输入?
JPA是否支持用户定义的类型参数?
SP:
create or replace PROCEDURE sp_sprintboot_test (
pn_input1 IN NUMBER,
ps_input2 IN VARCHAR2,
pn_output1 OUT NUMBER,
ps_output2 OUT VARCHAR2,
pt_output3 OUT TYPE_SPRINGBOOT_TEST)
AS
BEGIN
PN_OUTPUT1 := pn_input1 + 100;
ps_output2 := 'Test deneme ' || PS_INPUT2;
PT_OUTPUT3 := TYPE_SPRINGBOOT_TEST(247, 'Merkez');
END;
类型:
create or replace TYPE type_springboot_test as object
(
BRANCH NUMBER(5,0),
NAME VARCHAR2(500)
)
代码:
@Repository
public class TestSPRepositoryImp implements TestSPRepository {
@PersistenceContext
private EntityManager entityManager;
public String getTestData() {
StoredProcedureQuery query = entityManager
.createStoredProcedureQuery("sp_sprintboot_test")
.registerStoredProcedureParameter(1, Long.class,
ParameterMode.IN)
.registerStoredProcedureParameter(2, String.class,
ParameterMode.IN)
.registerStoredProcedureParameter(3, Long.class,
ParameterMode.OUT)
.registerStoredProcedureParameter(4, String.class,
ParameterMode.OUT)
.registerStoredProcedureParameter(5, TYPE_SPRINGBOOT_TEST.class,
ParameterMode.OUT)
.setParameter(1, 28L)
.setParameter(2, "Test Input");
query.execute();
Long output1 = (Long)query.getOutputParameterValue(3);
String output2 = (String)query.getOutputParameterValue(4);
TYPE_SPRINGBOOT_TEST output3 = (TYPE_SPRINGBOOT_TEST)query.getOutputParameterValue(5);
return "Output1 : " + output1 + " Output2 : " + output2 + " Output3 :" + output3;
}
}
public class TYPE_SPRINGBOOT_TEST {
Long BRANCH;
String NAME;
public Long getBRANCH() {
return BRANCH;
}
public void setBRANCH(Long BRANCH) {
this.BRANCH = BRANCH;
}
public String getNAME() {
return NAME;
}
public void setNAME(String NAME) {
this.NAME = NAME;
}
}