I want to use hibernate (spring jpa) to call stored procedure.In my stored procedures there are user defined types(udt) (in or out params) In hibernate example ,I see there is refcur parametermode but I cant find something about udt parameter types in oracle.How can call storedprocedure with user defined types.Can someone share any sample.
create or replace PROCEDURE SP_DEMO_SP
(
PId IN NUMBER,
pmyudt OUT mytype
)
TYPE mytype AS OBJECT
(
name VARCHAR2 (100),
food_group VARCHAR2 (100),
);
How can I model mytype in my java codes and use it to pass parameter for stored procedure
EntityManager em=(EntityManager)applicationContext.getBean(“myEntityManager”);
StoredProcedureQuery query=em.createStoredProcedureQuery(“SP_DEMO_SP”);
query.registerStoredProcedureParameter(“pID”, Double.class, ParameterMode.IN);
query.registerStoredProcedureParameter("pmyudt", mytype .class, ParameterMode.OUT);
query.setParameter("pID", 2d);
query.execute();
mytype sum = (mytype ) query.getOutputParameterValue("pmyudt");