Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » NamedStoredProcedureQuery with OracleTypes.STRUCT IN parameter doesn't pass String value to db
NamedStoredProcedureQuery with OracleTypes.STRUCT IN parameter doesn't pass String value to db [message #1814119] Wed, 04 September 2019 08:39 Go to next message
Tatiana Gaydukova is currently offline Tatiana GaydukovaFriend
Messages: 2
Registered: September 2019
Junior Member
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?
Re: NamedStoredProcedureQuery with OracleTypes.STRUCT IN parameter doesn't pass String value to db [message #1814138 is a reply to message #1814119] Wed, 04 September 2019 15:53 Go to previous message
Tatiana Gaydukova is currently offline Tatiana GaydukovaFriend
Messages: 2
Registered: September 2019
Junior Member
Was resolved by adding to project com.oracle.orai18n
Previous Topic:Foreign Key Constraint generation for SAP HANA Database
Next Topic:@ManyToMany: Why columns order in primary key depends on entity class names?
Goto Forum:
  


Current Time: Tue Oct 22 10:52:57 GMT 2019

Powered by FUDForum. Page generated in 0.01953 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top