code: public <V> V executeScalar(Class<V> returnType) {
          try (ResultSet rs = executeQuery()) {
              if (!rs.next()) {
                  Object value = null;
                  if (Integer.class == returnType) {
                      value = 0;
                  } else if (Long.class == returnType) {
                      value = 0L;
                  } else if (Boolean.class == returnType) {
                      value = false;
                  }
                  return returnType.cast(value);
              } else {
                  return getScalarFromResultSet(rs, returnType);
              }
          } catch (SQLException ex) {
              throw new ApplicationException(Code.BACKEND_ERROR, ex);
          }
      }
docs: Execute the PreparedStatement and return a single 'primitive' value from the ResultSet.
  
  @param returnType The type to return.
  @param <V> The type parameter to return a List of.
  @return A single result from the execution of the statement, as a type of {@literal returnType}.
  
  @throws ApplicationException {@literal returnType} is unsupported, cannot be cast to from the result, or any SQL
  errors occur.