How to return an Object type of database function called through session.doReturningWork?
How to return an Object type of database function called through session.doReturningWork?
I am calling a Database function using session.doReturningWork, however CallableStatement requires to pre-define a returning TYPE with registerOutParameter but I need and Object.class as returning type - This is because the function call is dinamically formed.
So:
Object result = session.doReturningWork(
connection ->
try (CallableStatement function = connection
.prepareCall(
" ? = call " + functionName + "(?,?) " ))
function.registerOutParameter( 1, Types.VARCHAR );
for(int i = 1; i < values.length; i++)
log.debug("<Util.executePl> values..." + values[i]);
function.setObject( i+1, values[i] );
function.execute();
return function.getString( 1 );
);
As you can see the output param is Types.VARCHAR, How to return an Object instead?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.