PostgreSQL's™ JDBC driver fully supports calling PostgreSQL™ stored functions.
Example 6.1. Calling a built in stored function
This example shows how to call a PostgreSQL™ built in function, upper, which simply converts the supplied string argument to uppercase.
// Turn transactions off.
con.setAutoCommit(false);
// Procedure call.
CallableStatement upperProc = con.prepareCall("{ ? = call upper( ? ) }");
upperProc.registerOutParameter(1, Types.VARCHAR);
upperProc.setString(2, "lowercase to uppercase");
upperProc.execute();
String upperCased = upperProc.getString(1);
upperProc.close();