I am trying to call a stored procedure in HsqlDB and return a Result Set
My Stored proc is as follows
CREATE PROCEDURE p_getTeamTasksForLastXDays(IN teamId BIGINT, IN numberOfDays BIGINT) READS SQL DATA
DYNAMIC RESULT SETS 1
BEGIN ATOMIC
declare curs cursor for select taskId, taskName from V_TASK_DETAILS;
open curs;
END;
/;
The Java and hibernate code I am using to call this proc is as follows
public void getTaskExecutionLogs(Long teamId, Long numberOfDays) {
LOG.info("Entered getTaskExecutionLogs Method - teamId:{}, numberOfDays: {}", teamId, numberOfDays);
ProcedureCall procedureCall = currentSession().createStoredProcedureCall("p_getTeamTasksForLastXDays");
procedureCall.registerParameter( TEAM_ID, Long.class, ParameterMode.IN ).bindValue( teamId );
procedureCall.registerParameter( NUMBER_OF_DAYS, Long.class, ParameterMode.IN ).bindValue( numberOfDays );
ProcedureOutputs outputs = procedureCall.getOutputs();
ResultSetOutput resultSetOutput = (ResultSetOutput) outputs.getCurrent();
List resultSetList = resultSetOutput.getResultList();
}
The error I get when I try to call this proc is as follows
java.lang.ClassCastException: org.hibernate.result.internal.UpdateCountOutputImpl cannot be cast to org.hibernate.result.ResultSetOutput
at com.mct.dao.database.impl.TaskDetailsDAOImpl.getTaskExecutionLogs(TaskDetailsDAOImpl.java:229)
The exact same code works ok when I try to call a stored proc in MySql
Any help is greatly appreciated
Thanks Damien