Oracle Database 18c
There is procedure with following specification in database:
CREATE or replace PROCEDURE TCS_RATEBASE_RENEWAL_CB_PARAM(pCbRates TCS_PG_RATE)
create or replace type TCS_PG_RATE force is object
(
security_code varchar2(50),
rate_value number
)
I call it from application this way:
@PersistenceContext(unitName = JpaConfig.JPA_UNIT_NAME)
private EntityManager entityManager;
@Modifying
public void refreshCbRateProcedure(Collection<CbRate> cbRates) {
StoredProcedureQuery query = entityManager.createNamedStoredProcedureQuery("TCS_RATEBASE_RENEWAL_CB_PARAM");
RateSqlType rate = new RateSqlType("code", 123d);
query.setParameter("PCBRATES", rate);
query.execute();
}
@Data
@NamedStoredProcedureQuery(
name="TCS_RATEBASE_RENEWAL_CB_PARAM",
procedureName="TCS_RATEBASE_RENEWAL_CB_PARAM",
parameters={
@StoredProcedureParameter(queryParameter = "PCBRATES", jdbcType = OracleTypes.STRUCT, jdbcTypeName = "TCS_PG_RATE")
}
)
@Embeddable
@Struct(name="TCS_PG_RATE", fields={"SECURITY_CODE", "RATE_VALUE"})
@Entity
public class RateSqlType implements Serializable {
@Id
@Column(name = "SECURITY_CODE", columnDefinition = "VARCHAR2(50)")
private String securityCode;
@Column(name = "RATE_VALUE", precision = 20, scale = 10)
private Double rate;
public RateSqlType(String securityCode, Double rate) {
this.setSecurityCode(securityCode);
this.setRate(rate);
}
@Override
public String toString() {
return "RateSqlType [securityCode=" + securityCode + ", rate="
+ rate + "]";
}
}
In plsql procedure I log input parameters' values. Number field value equals 123d, but varchar2 field is null.
What is the reason?