You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-dev@db.apache.org by Craig Russell <cr...@oracle.com> on 2017/03/17 20:04:09 UTC

setParameters, setNamedParameters

These methods are the only ones that can be used with the new execute methods to set parameters.

Sadly, they are not thread-safe, which is a problem considering that the Query object is supposed to be thread-safe.

I’d like to update the description to include the expected thread behavior:

* Parameter values are stored in thread local storage so the same Query object
* can be used by multiple threads simultaneously.

    /**
     * Method to set the named parameters on this query prior to execution.
     * If using the execute methods taking parameters then those parameter values will override these values.
     * All parameter values specified in this method will only be retained until the subsequent query execution.
     * @param namedParamMap The map of parameter values keyed by their names.
     * @return This query
     */
    Query<T> setNamedParameters(Map<String, ?> namedParamMap);

    /**
     * Method to set the values of the numbered parameters on this query prior to execution.
     * If using the execute methods taking parameters then those parameter values will override these values.
     * All parameter values specified in this method will only be retained until the subsequent query execution.
     * @param paramValues Values of the numbered parameters, in order.
     * @return This query
     */
    Query<T> setParameters(Object... paramValues);


Craig L Russell
Architect
craig.russell@oracle.com
P.S. A good JDO? O, Gasp!