Top Description Methods
org.jooq

public non-sealed Interface Param<T>

extends ParamOrVariable<T>
Known Direct Implementers
org.jooq.impl.AbstractParamX
Imports
org.jooq.conf.ParamType, .Settings, org.jooq.exception.DataTypeException, org.jooq.impl.DSL, .QOM, org.jetbrains.annotations.NotNull, .Nullable, .ApiStatus.Experimental

Deprecated

as a consequence of ParamOrVariable being deprecated. See corresponding docs for further information.

A named parameter and/or bind value.

A lot of jOOQ API accepts user input values, such as for example when creating a Condition using Field#eq(Object), where a column expression is being compared with a value.

Behind the scenes, jOOQ wraps the value in a bind value expression using DSL#val(Object). The generated SQL of such an expression depends on things like Settings#getStatementType() or ParamType being passed to configurations or Query#getSQL(ParamType) calls, etc. By default, a parameter marker ? is generated.

Users can create parameters explicitly using DSL API, which is useful in a few cases where the value cannot be passed to jOOQ directly, e.g.

Example:


// Assuming import static org.jooq.impl.DSL.*;

// The bind value is the first operand of an expression, in case of which it
// needs to be wrapped in a Param explicitly
using(configuration)
   .select()
   .from(RENTALS)
   .where(val(LocalDateTime.now()).between(RENTALS.RENTAL_DATE).and(RENTALS.DUE_DATE))
   .fetch();

// The bind value is mixed with other types of Field expressions in a statement
using(configuration)
   .insertInto(ACTOR)
   .columns(ACTOR.FIRST_NAME, ACTOR.LAST_NAME, ACTOR.LAST_UPDATE)
   .values(val("John"), val("Doe"), currentTimestamp())
   .execute();

Instances can be created using DSL#param(String, Object), DSL#val(Object), DSL#inline(Object) and respective overloads.

Author
Lukas Eder
See Also
DSL#param(String, Object)

Method Summary

Modifier and TypeMethod and Description
public boolean
$inline()

Experimental query object model accessor method, see also QOM.

public @NotNull Param<T>
$inline(boolean inline)

Deprecated as a consequence of Param being deprecated.
Experimental query object model accessor method, see also QOM.
public T
$value()

Experimental query object model accessor method, see also QOM.

public @NotNull Param<T>
$value(T value)

Deprecated as a consequence of Param being deprecated.
Experimental query object model accessor method, see also QOM.
public @NotNull ParamMode
getParamMode()

The parameter mode.

public @Nullable String
getParamName()

The parameter name.

public @NotNull ParamType
getParamType()

The parameter type.

public T
getValue()

Get the parameter's underlying value.

public boolean
isInline()

A flag on the bind value to force it to be inlined in rendered SQL

public void
setConverted(Object value)

Deprecated for removal since 3.8. - 3.8.0 - [#4991] In jOOQ 4.0, Param will be made immutable.
Sets a converted value, using this Param's underlying DataType, obtained from getDataType()
public void
setInline(boolean inline)

Deprecated for removal since 3.8. - 3.8.0 - [#4991] In jOOQ 4.0, Param will be made immutable.
A flag on the bind value to force it to be inlined in rendered SQL
public void
setValue(T value)

Deprecated for removal since 3.8. - 3.8.0 - [#4991] In jOOQ 4.0, Param will be made immutable.
Set the parameter's underlying value.

Method Detail

$inlineback to summary
public boolean $inline()

Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.

Annotations
@Experimental
$inlineback to summary
public @NotNull Param<T> $inline(boolean inline)

Deprecated

as a consequence of Param being deprecated. See corresponding docs for further information.

Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.

Annotations
@Experimental
@NotNull
$valueback to summary
public T $value()

Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.

Annotations
@Experimental
$valueback to summary
public @NotNull Param<T> $value(T value)

Deprecated

as a consequence of Param being deprecated. See corresponding docs for further information.

Experimental query object model accessor method, see also QOM. Subject to change in future jOOQ versions, use at your own risk.

Annotations
@Experimental
@NotNull
getParamModeback to summary
public @NotNull ParamMode getParamMode()

The parameter mode.

Annotations
@NotNull
getParamNameback to summary
public @Nullable String getParamName()

The parameter name. This name is useful for two things:

Annotations
@Nullable
getParamTypeback to summary
public @NotNull ParamType getParamType()

The parameter type.

Annotations
@NotNull
getValueback to summary
public T getValue()

Get the parameter's underlying value. This returns null if no value has been set yet.

Annotations
@Nullable
isInlineback to summary
public boolean isInline()

A flag on the bind value to force it to be inlined in rendered SQL

setConvertedback to summary
public void setConverted(Object value) throws DataTypeException

Deprecated

for removal since 3.8.

- 3.8.0 - [#4991] In jOOQ 4.0, Param will be made immutable. Modifying Param values is strongly discouraged.

Sets a converted value, using this Param's underlying DataType, obtained from getDataType()

Annotations
@Deprecated
forRemoval:true
since:3.8
Exceptions
DataTypeException:
If value cannot be converted into this parameter's data type.
setInlineback to summary
public void setInline(boolean inline)

Deprecated

for removal since 3.8.

- 3.8.0 - [#4991] In jOOQ 4.0, Param will be made immutable. Modifying Param values is strongly discouraged.

A flag on the bind value to force it to be inlined in rendered SQL

Annotations
@Deprecated
forRemoval:true
since:3.8
setValueback to summary
public void setValue(T value)

Deprecated

for removal since 3.8.

- 3.8.0 - [#4991] In jOOQ 4.0, Param will be made immutable. Modifying Param values is strongly discouraged.

Set the parameter's underlying value. This is the same as setConverted(Object), but ensures generic type-safety.

Annotations
@Deprecated
forRemoval:true
since:3.8
See Also
setConverted(Object)