Class JpaCriteriaParameter<T>
- java.lang.Object
-
- org.hibernate.query.sqm.tree.AbstractSqmNode
-
- org.hibernate.query.sqm.tree.jpa.AbstractJpaTupleElement<T>
-
- org.hibernate.query.sqm.tree.jpa.AbstractJpaSelection<T>
-
- org.hibernate.query.sqm.tree.expression.AbstractSqmExpression<T>
-
- org.hibernate.query.sqm.tree.expression.JpaCriteriaParameter<T>
-
- All Implemented Interfaces:
Expression<T>
,ParameterExpression<T>
,Selection<T>
,Parameter<T>
,TupleElement<T>
,Serializable
,Comparable<SqmParameter<T>>
,JpaCriteriaNode
,JpaExpression<T>
,JpaParameterExpression<T>
,JpaSelection<T>
,JpaTupleElement<T>
,QueryParameter<T>
,QueryParameterImplementor<T>
,SqmExpression<T>
,SqmParameter<T>
,SqmSelectableNode<T>
,SqmExpressibleAccessor<T>
,SqmNode
,SqmTypedNode<T>
,SqmVisitableNode
- Direct Known Subclasses:
ValueBindJpaCriteriaParameter
public class JpaCriteriaParameter<T> extends AbstractSqmExpression<T> implements SqmParameter<T>, QueryParameterImplementor<T>
JpaParameterExpression
created via JPACriteriaBuilder
.Each occurrence of a
JpaParameterExpression
results in a uniqueSqmParameter
.
-
-
Constructor Summary
Constructors Modifier Constructor Description JpaCriteriaParameter(String name, BindableType<? super T> type, boolean allowsMultiValuedBinding, NodeBuilder nodeBuilder)
protected
JpaCriteriaParameter(JpaCriteriaParameter<T> original)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <X> X
accept(SemanticQueryWalker<X> walker)
Accept the walker per visitationboolean
allowMultiValuedBinding()
Can a collection/array of values be bound to this parameter?boolean
allowsMultiValuedBinding()
Does this parameter allow multi-valued (collection, array, etc) binding?void
appendHqlString(StringBuilder sb)
void
applyAnticipatedType(BindableType type)
int
compareTo(SqmParameter anotherParameter)
SqmParameter<T>
copy()
Make a copyJpaCriteriaParameter<T>
copy(SqmCopyContext context)
void
disallowMultiValuedBinding()
boolean
equals(Object o)
BindableType<T>
getAnticipatedType()
Based on the context it is declared, what is the anticipated type for bind values?BindableType<T>
getHibernateType()
Get the Hibernate Type associated with this parameter, if one.String
getName()
If this represents a named parameter, return that parameter name; otherwise returnnull
.Class<T>
getParameterType()
Integer
getPosition()
If this represents a positional parameter, return that parameter position; otherwise returnnull
.Integer
getTupleLength()
T
getValue()
int
hashCode()
protected void
internalApplyInferableType(SqmExpressible<?> newType)
NamedCallableQueryMemento.ParameterMemento
toMemento()
-
Methods inherited from class org.hibernate.query.sqm.tree.expression.AbstractSqmExpression
alias, applyInferableType, as, asBigDecimal, asBigInteger, asDouble, asFloat, asInteger, asLong, asString, equalTo, equalTo, getJavaTypeDescriptor, in, in, in, in, isNotNull, isNull, nodeBuilder
-
Methods inherited from class org.hibernate.query.sqm.tree.jpa.AbstractJpaSelection
getSelectionItems, isCompoundSelection
-
Methods inherited from class org.hibernate.query.sqm.tree.jpa.AbstractJpaTupleElement
copyTo, getAlias, getNodeType, setAlias, setExpressibleType
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.query.criteria.JpaSelection
alias, getCompoundSelectionItems, getSelectionItems
-
Methods inherited from interface org.hibernate.query.criteria.JpaTupleElement
getJavaType, getJavaTypeDescriptor
-
Methods inherited from interface jakarta.persistence.criteria.Selection
isCompoundSelection
-
Methods inherited from interface org.hibernate.query.sqm.tree.expression.SqmExpression
applyInferableType, as, asBigDecimal, asBigInteger, asDouble, asFloat, asInteger, asLong, asString, castAs, equalTo, equalTo, in, in, in, in, isNotNull, isNull, visitSubSelectableNodes
-
Methods inherited from interface org.hibernate.query.sqm.tree.SqmNode
asLoggableText, nodeBuilder
-
Methods inherited from interface org.hibernate.query.sqm.tree.expression.SqmParameter
getNodeType
-
Methods inherited from interface org.hibernate.query.sqm.tree.SqmTypedNode
getExpressible, getNodeJavaType
-
Methods inherited from interface org.hibernate.query.sqm.tree.SqmVisitableNode
toHqlString
-
Methods inherited from interface jakarta.persistence.TupleElement
getAlias
-
-
-
-
Constructor Detail
-
JpaCriteriaParameter
public JpaCriteriaParameter(String name, BindableType<? super T> type, boolean allowsMultiValuedBinding, NodeBuilder nodeBuilder)
-
JpaCriteriaParameter
protected JpaCriteriaParameter(JpaCriteriaParameter<T> original)
-
-
Method Detail
-
copy
public JpaCriteriaParameter<T> copy(SqmCopyContext context)
- Specified by:
copy
in interfaceSqmExpression<T>
- Specified by:
copy
in interfaceSqmNode
- Specified by:
copy
in interfaceSqmParameter<T>
- Specified by:
copy
in interfaceSqmSelectableNode<T>
- Specified by:
copy
in interfaceSqmTypedNode<T>
-
getName
public String getName()
Description copied from interface:SqmParameter
If this represents a named parameter, return that parameter name; otherwise returnnull
.
-
getValue
public T getValue()
-
getPosition
public Integer getPosition()
Description copied from interface:SqmParameter
If this represents a positional parameter, return that parameter position; otherwise returnnull
.- Specified by:
getPosition
in interfaceParameter<T>
- Specified by:
getPosition
in interfaceSqmParameter<T>
- Returns:
- The parameter position
-
getTupleLength
public Integer getTupleLength()
- Specified by:
getTupleLength
in interfaceSqmSelectableNode<T>
-
allowsMultiValuedBinding
public boolean allowsMultiValuedBinding()
Description copied from interface:QueryParameter
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.
- Specified by:
allowsMultiValuedBinding
in interfaceQueryParameter<T>
- Returns:
true
indicates that multi-valued binding is allowed for this parameter
-
disallowMultiValuedBinding
public void disallowMultiValuedBinding()
- Specified by:
disallowMultiValuedBinding
in interfaceQueryParameterImplementor<T>
-
allowMultiValuedBinding
public boolean allowMultiValuedBinding()
Description copied from interface:SqmParameter
Can a collection/array of values be bound to this parameter?This is allowed in very limited contexts within the query:
- as the value of an IN predicate if the only value is a single param
- (in non-strict JPA mode) as the final vararg to a function
- Specified by:
allowMultiValuedBinding
in interfaceSqmParameter<T>
- Returns:
true
if binding collection/array of values is allowed for this parameter;false
otherwise.
-
getAnticipatedType
public BindableType<T> getAnticipatedType()
Description copied from interface:SqmParameter
Based on the context it is declared, what is the anticipated type for bind values?NOTE: If
SqmParameter.allowMultiValuedBinding()
is true, this will indicate the Type of the individual values.- Specified by:
getAnticipatedType
in interfaceSqmParameter<T>
- Returns:
- The anticipated Type.
-
applyAnticipatedType
public void applyAnticipatedType(BindableType type)
- Specified by:
applyAnticipatedType
in interfaceQueryParameterImplementor<T>
-
copy
public SqmParameter<T> copy()
Description copied from interface:SqmParameter
Make a copy- Specified by:
copy
in interfaceSqmParameter<T>
-
getHibernateType
public BindableType<T> getHibernateType()
Description copied from interface:QueryParameter
Get the Hibernate Type associated with this parameter, if one. May returnnull
.- Specified by:
getHibernateType
in interfaceQueryParameter<T>
- Returns:
- The associated Hibernate Type, may be
null
.
-
getParameterType
public Class<T> getParameterType()
- Specified by:
getParameterType
in interfaceParameter<T>
-
internalApplyInferableType
protected void internalApplyInferableType(SqmExpressible<?> newType)
- Overrides:
internalApplyInferableType
in classAbstractSqmExpression<T>
-
accept
public <X> X accept(SemanticQueryWalker<X> walker)
Description copied from interface:SqmVisitableNode
Accept the walker per visitation- Specified by:
accept
in interfaceSqmVisitableNode
-
toMemento
public NamedCallableQueryMemento.ParameterMemento toMemento()
- Specified by:
toMemento
in interfaceQueryParameterImplementor<T>
-
appendHqlString
public void appendHqlString(StringBuilder sb)
- Specified by:
appendHqlString
in interfaceSqmVisitableNode
-
compareTo
public int compareTo(SqmParameter anotherParameter)
- Specified by:
compareTo
in interfaceComparable<T>
- Specified by:
compareTo
in interfaceSqmParameter<T>
-
-