i'm making a connection to an oracle db. I just solved problem with dependency (into the following url there's the needed code like respository, entity etc.):
Now i'm facing problem with casting exeption when i call the repository. The repository sent me back a list of ForwardOnlyResultSet and i'm not able to map my results. that's the error:
Cannot cast 'oracle.jdbc.driver.ForwardOnlyResultSet' to 'procedure.entity.PocRegions'
my oracle pl/sql procedure is that:
PROCEDURE PRO_RETURN_REGION(
id_region IN POC_REGIONS.REGION_ID%TYPE,
o_cursor OUT SYS_REFCURSOR) is
BEGIN
--Opening the cursor to return matched rows
open o_cursor for
select *
from POC_REGIONS
where POC_REGIONS.REGION_ID = id_region;
END PRO_RETURN_REGION;
Then i tryed to bot implement the call with jpa calls and spring-data-jpa call:
StoredProcedureQuery query = entityManager.createStoredProcedureQuery( "POC_PKG_GEO.PRO_RETURN_REGION");
query.registerStoredProcedureParameter("id_region", BigDecimal.class, ParameterMode.IN);
query.registerStoredProcedureParameter("o_cursor", void.class, ParameterMode.REF_CURSOR);
query.setParameter("id_region", id);
query.execute();
//Contains a forwardonlyreswultset (jpa call)
Object res = query.getOutputParameterValue("o_cursor");
//Contains an array of 2 Object not mapped (jpa call)
List<PocRegions> resultList = query.getResultList();
//Contains a forwardonlyreswultset (spring-data-jpa call)
List<PocRegions> region = geoRegionRepo.getRegion(id);
How should I be supposed to convert/map the retrieved value, to my entity?
Thank you