I am looking for the best practice about passing values from a callable parameter object to separate variables.
I am using an object of callable parameters to pass values to variables. I am using numbers to represent the values of every parameter. Is there a more efficient way?
//CREATES NEW OBJECT FOR COLLABLE PARAMETERS
CallableParameters params = new CallableParameters();
//PASS INPUT VALUES
params.addParamIn(ID(),Types.INTEGER);
params.addParamIn(NUMBER(),Types.INTEGER);
//RETURN OUTPUT VALUES
params.addParamIn(CITY(),Types.VARCHAR);
params.addParamIn(YEAR(),Types.INTEGER);
//EXECUTE THE COLLABLE STATEMENT TO RUN THE STORED PROCEDURE
CallableStatement.executeCallable(callableName, params, conn);
Then I try to pass the values to variables like this:
String CITY = (Integer)params.getParams().get(3).getParamValue();
int YEAR=(String)params.getParams().get(4).getParamValue();
Is there a better way to call my variables instead of get(3), like enum with names and like?