Top Description Methods
org.hibernate.query.sqm.tree.expression

public Interface SqmParameter<T>

extends SqmExpression<T>, JpaParameterExpression<T>, Comparable<SqmParameter<T>>
Known Direct Implementers
org.hibernate.query.sqm.tree.expression.AbstractSqmParameter, org.hibernate.query.sqm.tree.expression.JpaCriteriaParameter, org.hibernate.query.sqm.tree.expression.SqmJpaCriteriaParameterWrapper
Imports
org.hibernate.HibernateException, org.hibernate.query.BindableType, org.hibernate.query.criteria.JpaParameterExpression, org.hibernate.query.sqm.SqmExpressible, org.hibernate.query.sqm.tree.SqmCopyContext

Models a parameter expression declared in the query.

Implementation Note

Each usage of a given named/positional query parameter will result in a unique SqmParameter instance, each will simply use to the same binding. This is important to distinguish usage of the same parameter in different clauses which effects the rendering and value binding.

Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if binding collection/array of values is allowed for this parameter; false otherwise.
allowMultiValuedBinding
()

Can a collection/array of values be bound to this parameter?

public default int
compareTo(SqmParameter<T>
the object to be compared.
anotherParameter
)

Implements java.lang.Comparable.compareTo.

Compares this object with the specified object for order.
public SqmParameter<T>
copy()

Make a copy

public SqmParameter<T>
public BindableType<T>

Returns:

The anticipated Type.
getAnticipatedType
()

Based on the context it is declared, what is the anticipated type for bind values?

public String

Returns:

The parameter name, or null if not a named parameter
getName
()

Redeclares jakarta.persistence.Parameter.getName.

If this represents a named parameter, return that parameter name; otherwise return null.
public SqmExpressible<T>
public Integer

Returns:

The parameter position
getPosition
()

Redeclares jakarta.persistence.Parameter.getPosition.

If this represents a positional parameter, return that parameter position; otherwise return null.
Inherited from org.hibernate.query.sqm.tree.expression.SqmExpression:
applyInferableTypeasasBigDecimalasBigIntegerasDoubleasFloatasIntegerasLongasStringcastAsequalToequalToininininisNotNullisNullvisitSubSelectableNodes

Method Detail

allowMultiValuedBindingback to summary
public boolean allowMultiValuedBinding()

Can a collection/array of values be bound to this parameter?

This is allowed in very limited contexts within the query:

  1. as the value of an IN predicate if the only value is a single param
  2. (in non-strict JPA mode) as the final vararg to a function
Returns:boolean

true if binding collection/array of values is allowed for this parameter; false otherwise.

compareToback to summary
public default int compareTo(SqmParameter<T> anotherParameter)

Implements java.lang.Comparable.compareTo.

Doc from java.lang.Comparable.compareTo.

Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure signum(x.compareTo(y)) == -signum(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception if and only if y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y) > 0 && y.compareTo(z) > 0) implies x.compareTo(z) > 0.

Finally, the implementor must ensure that x.compareTo(y)==0 implies that signum(x.compareTo(z)) == signum(y.compareTo(z)), for all z.

Implementation Specification

Defined as default since this is an SPI to support any previous extensions

Parameters
anotherParameter:SqmParameter<T>

the object to be compared.

Returns:int

a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Annotations
@Override
copyback to summary
public SqmParameter<T> copy()

Make a copy

copyback to summary
public SqmParameter<T> copy(SqmCopyContext context)

Redeclares org.hibernate.query.sqm.tree.expression.SqmExpression.copy.

Annotations
@Override
getAnticipatedTypeback to summary
public BindableType<T> getAnticipatedType()

Based on the context it is declared, what is the anticipated type for bind values?

Note

If allowMultiValuedBinding() is true, this will indicate the Type of the individual values.

Returns:BindableType<T>

The anticipated Type.

getNameback to summary
public String getName()

Redeclares jakarta.persistence.Parameter.getName.

If this represents a named parameter, return that parameter name; otherwise return null.

Returns:String

The parameter name, or null if not a named parameter

getNodeTypeback to summary
public SqmExpressible<T> getNodeType()

Redeclares org.hibernate.query.sqm.tree.expression.SqmExpression.getNodeType.

Doc from org.hibernate.query.sqm.tree.expression.SqmExpression.getNodeType.

The expression's type.

Can change as a result of calls to applyInferableType

Annotations
@Override
getPositionback to summary
public Integer getPosition()

Redeclares jakarta.persistence.Parameter.getPosition.

If this represents a positional parameter, return that parameter position; otherwise return null.

Returns:Integer

The parameter position