I all!
How can I read an oracle type with an array property? The oracle type is the following:
where OBJ_EMAIL_ARRAY is:Code:create or replace type OBJ_USER as object ( ID_USER NUMBER(15), NAME VARCHAR2(50), SURNAME VARCHAR2(50), BIRTH_DATE DATE, EMAIL OBJ_EMAIL_ARRAY ) not final;
and OBJ_EMAIL is:Code:create or replace type OBJ_EMAIL_ARRAY is table of OBJ_EMAIL;
The Java mapping class has these properties (setter and getter omitted):Code:create or replace type OBJ_EMAIL as object ( ID_EMAIL NUMBER(15), PRIORITY NUMBER(3), EMAIL VARCHAR2(100) ) final;
If I try to read this object with this PL/SQL package function (it sets internally the array property):Code:public class User { private Long idUser; private String name; private String surname; private Date birthDate; private List<Email> email;using this Java code:Code:function ReadUser(pIdUser in number) return Obj_user;
I get:Code:this.getUser = new SimpleJdbcCall(dataSource).withProcedureName(SQL_READ_USER) .declareParameters( new SqlOutParameter("PARAM_RESULT", OracleTypes.STRUCT, OBJ_USER, new SqlReturnStruct(User.class))); this.getUser.setFunction(true); this.getUser.setCatalogName(PACKAGE_NAME); @Override public User readUser(Long idUser) { Map in = Collections.singletonMap("pIdUser", idUser); return getUser.executeObject(User.class, in); }
org.springframework.beans.ConversionNotSupportedEx ception: Failed to convert property value of type 'oracle.sql.ARRAY' to required type 'java.util.List' for property 'email'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [oracle.sql.ARRAY] to required type [com.acme.oracletype.domain.Email] for property 'email[0]': no matching editors or conversion strategy found
Because of course nobody instructed SimpleJdbcCall how to convert the ARRAY of emails.
But how can be SimpleJdbcCall instructed to perform this conversion?
Thanks in advance!


Reply With Quote
