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

public Class JpaCriteriaParameter<T>

extends AbstractSqmExpression<T>
implements SqmParameter<T>, QueryParameterImplementor<T>
Class Inheritance
All Implemented Interfaces
org.hibernate.query.spi.QueryParameterImplementor, org.hibernate.query.QueryParameter, jakarta.persistence.Parameter, org.hibernate.query.sqm.tree.expression.SqmParameter, java.lang.Comparable, org.hibernate.query.criteria.JpaParameterExpression, org.hibernate.query.criteria.JpaCriteriaNode, java.io.Serializable, jakarta.persistence.criteria.ParameterExpression, jakarta.persistence.criteria.Expression, jakarta.persistence.criteria.Selection, jakarta.persistence.TupleElement, org.hibernate.query.sqm.tree.expression.SqmExpression, org.hibernate.query.criteria.JpaExpression, org.hibernate.query.criteria.JpaSelection, org.hibernate.query.criteria.JpaTupleElement, org.hibernate.query.sqm.tree.select.SqmSelectableNode, org.hibernate.query.sqm.tree.SqmTypedNode, org.hibernate.query.sqm.tree.SqmVisitableNode, org.hibernate.query.sqm.tree.SqmNode, org.hibernate.query.sqm.tree.SqmExpressibleAccessor
Known Direct Subclasses
org.hibernate.query.sqm.tree.expression.ValueBindJpaCriteriaParameter
Imports
java.util.Objects, org.hibernate.procedure.spi.NamedCallableQueryMemento, org.hibernate.query.BindableType, .ParameterMetadata, org.hibernate.query.criteria.JpaParameterExpression, org.hibernate.query.spi.QueryParameterImplementor, org.hibernate.query.sqm.NodeBuilder, .SemanticQueryWalker, .SqmExpressible, org.hibernate.query.sqm.tree.SqmCopyContext

JpaParameterExpression created via JPA jakarta.persistence.criteria.CriteriaBuilder.

Each occurrence of a JpaParameterExpression results in a unique SqmParameter.

Author
Steve Ebersole
See Also
ParameterMetadata, NodeBuilder#parameter

Field Summary

Modifier and TypeField and Description
private boolean
private final String

Constructor Summary

AccessConstructor and Description
public
JpaCriteriaParameter(String name, BindableType<? super T> type, boolean allowsMultiValuedBinding, NodeBuilder nodeBuilder)

protected

Method Summary

Modifier and TypeMethod and Description
public <X> X
accept(SemanticQueryWalker<X> walker)

Implements org.hibernate.query.sqm.tree.SqmVisitableNode.accept.

Accept the walker per visitation
public boolean
allowMultiValuedBinding()

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.allowMultiValuedBinding.

Can a collection/array of values be bound to this parameter?
public boolean
allowsMultiValuedBinding()

Implements org.hibernate.query.QueryParameter.allowsMultiValuedBinding.

Does this parameter allow multi-valued (collection, array, etc) binding?
public void
public void
public int
compareTo(SqmParameter<T>
the object to be compared.
anotherParameter
)

Overrides default org.hibernate.query.sqm.tree.expression.SqmParameter.compareTo.

Compares this object with the specified object for order.
public JpaCriteriaParameter<T>
public SqmParameter<T>
public void
public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public BindableType<T>
getAnticipatedType()

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.getAnticipatedType.

Based on the context it is declared, what is the anticipated type for bind values?
public BindableType<T>
getHibernateType()

Implements org.hibernate.query.QueryParameter.getHibernateType.

Get the Hibernate Type associated with this parameter, if one.
public String
getName()

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.getName, jakarta.persistence.Parameter.getName.

If this represents a named parameter, return that parameter name; otherwise return null.
public Class<T>
getParameterType()

Implements jakarta.persistence.Parameter.getParameterType.

Return the Java type of the parameter.
public Integer
getPosition()

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.getPosition, jakarta.persistence.Parameter.getPosition.

If this represents a positional parameter, return that parameter position; otherwise return null.
public Integer
public T
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
protected void
public NamedCallableQueryMemento.ParameterMemento
private static <T> SqmExpressible<T>
toSqmType(BindableType<T> type, NodeBuilder nodeBuilder)

Inherited from org.hibernate.query.sqm.tree.expression.AbstractSqmExpression:
aliasapplyInferableTypeasasBigDecimalasBigIntegerasDoubleasFloatasIntegerasLongasStringequalToequalTogetJavaTypeDescriptorininininisNotNullisNullnodeBuilder

Field Detail

allowsMultiValuedBindingback to summary
private boolean allowsMultiValuedBinding
nameback to summary
private final String name

Constructor Detail

JpaCriteriaParameterback to summary
public JpaCriteriaParameter(String name, BindableType<? super T> type, boolean allowsMultiValuedBinding, NodeBuilder nodeBuilder)
JpaCriteriaParameterback to summary
protected JpaCriteriaParameter(JpaCriteriaParameter<T> original)

Method Detail

acceptback to summary
public <X> X accept(SemanticQueryWalker<X> walker)

Implements org.hibernate.query.sqm.tree.SqmVisitableNode.accept.

Doc from org.hibernate.query.sqm.tree.SqmVisitableNode.accept.

Accept the walker per visitation

Annotations
@Override
allowMultiValuedBindingback to summary
public boolean allowMultiValuedBinding()

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.allowMultiValuedBinding.

Doc from org.hibernate.query.sqm.tree.expression.SqmParameter.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.

Annotations
@Override
allowsMultiValuedBindingback to summary
public boolean allowsMultiValuedBinding()

Implements org.hibernate.query.QueryParameter.allowsMultiValuedBinding.

Doc from org.hibernate.query.QueryParameter.allowsMultiValuedBinding.

Does this parameter allow multi-valued (collection, array, etc) binding?

This is only valid for HQL/JPQL and (I think) Criteria queries, and is determined based on the context of the parameters declaration.

Returns:boolean

true indicates that multi-valued binding is allowed for this parameter

Annotations
@Override
appendHqlStringback to summary
public void appendHqlString(StringBuilder sb)

Implements org.hibernate.query.sqm.tree.SqmVisitableNode.appendHqlString.

Annotations
@Override
applyAnticipatedTypeback to summary
public void applyAnticipatedType(BindableType<J> type)

Implements org.hibernate.query.spi.QueryParameterImplementor.applyAnticipatedType.

Annotations
@SuppressWarnings:rawtypes, unchecked
@Override
compareToback to summary
public int compareTo(SqmParameter<T> anotherParameter)

Overrides default org.hibernate.query.sqm.tree.expression.SqmParameter.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.

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 JpaCriteriaParameter<T> copy(SqmCopyContext context)

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.copy, org.hibernate.query.sqm.tree.expression.SqmExpression.copy, org.hibernate.query.sqm.tree.select.SqmSelectableNode.copy, org.hibernate.query.sqm.tree.SqmNode.copy.

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

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.copy.

Doc from org.hibernate.query.sqm.tree.expression.SqmParameter.copy.

Make a copy

Annotations
@Override
disallowMultiValuedBindingback to summary
public void disallowMultiValuedBinding()

Implements org.hibernate.query.spi.QueryParameterImplementor.disallowMultiValuedBinding.

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

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

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.getAnticipatedType.

Doc from org.hibernate.query.sqm.tree.expression.SqmParameter.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.

Annotations
@Override
getHibernateTypeback to summary
public BindableType<T> getHibernateType()

Implements org.hibernate.query.QueryParameter.getHibernateType.

Doc from org.hibernate.query.QueryParameter.getHibernateType.

Get the Hibernate Type associated with this parameter, if one. May return null.

Returns:BindableType<T>

The associated Hibernate Type, may be null.

Annotations
@Override
getNameback to summary
public String getName()

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.getName, jakarta.persistence.Parameter.getName.

Doc from org.hibernate.query.sqm.tree.expression.SqmParameter.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

Annotations
@Override
getParameterTypeback to summary
public Class<T> getParameterType()

Implements jakarta.persistence.Parameter.getParameterType.

Doc from jakarta.persistence.Parameter.getParameterType.

Return the Java type of the parameter. Values bound to the parameter must be assignable to this type. This method is required to be supported for criteria queries only. Applications that use this method for Jakarta Persistence query language queries and native queries will not be portable.

Returns:Class<T>

the Java type of the parameter

Annotations
@Override
getPositionback to summary
public Integer getPosition()

Implements org.hibernate.query.sqm.tree.expression.SqmParameter.getPosition, jakarta.persistence.Parameter.getPosition.

Doc from org.hibernate.query.sqm.tree.expression.SqmParameter.getPosition.

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

Returns:Integer

The parameter position

Annotations
@Override
getTupleLengthback to summary
public Integer getTupleLength()

Overrides default org.hibernate.query.sqm.tree.select.SqmSelectableNode.getTupleLength.

Annotations
@Override
getValueback to summary
public T getValue()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
internalApplyInferableTypeback to summary
protected void internalApplyInferableType(SqmExpressible<?> newType)

Overrides org.hibernate.query.sqm.tree.expression.AbstractSqmExpression.internalApplyInferableType.

Annotations
@Override
toMementoback to summary
public NamedCallableQueryMemento.ParameterMemento toMemento()

Implements org.hibernate.query.spi.QueryParameterImplementor.toMemento.

Annotations
@Override
toSqmTypeback to summary
private static <T> SqmExpressible<T> toSqmType(BindableType<T> type, NodeBuilder nodeBuilder)