org.hibernate.query.sqm.tree.expression.SqmParameter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-core Show documentation
Show all versions of hibernate-core Show documentation
Hibernate's core ORM functionality
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.query.sqm.tree.expression;
import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.query.criteria.JpaParameterExpression;
/**
* Models a parameter expression declared in the query.
*
* @implNote 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
*/
public interface SqmParameter extends SqmExpression, JpaParameterExpression {
/**
* If this represents a named parameter, return that parameter name;
* otherwise return {@code null}.
*
* @return The parameter name, or {@code null} if not a named parameter
*/
String getName();
/**
* If this represents a positional parameter, return that parameter position;
* otherwise return {@code null}.
*
* @return The parameter position
*/
Integer getPosition();
/**
* 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
*
*
* @return {@code true} if binding collection/array of values is allowed
* for this parameter; {@code false} otherwise.
*/
boolean allowMultiValuedBinding();
/**
* Based on the context it is declared, what is the anticipated type for
* bind values?
*
* NOTE: If {@link #allowMultiValuedBinding()} is true, this will indicate
* the Type of the individual values.
*
* @return The anticipated Type.
*/
AllowableParameterType getAnticipatedType();
@Override
AllowableParameterType getNodeType();
/**
* Make a copy
*/
SqmParameter copy();
}