All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.query.sqm.tree.expression.SqmParameter Maven / Gradle / Ivy

There is a newer version: 7.0.0.Alpha3
Show newest version
/*
 * 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:

    *
  1. as the value of an IN predicate if the only value is a single param
  2. *
  3. (in non-strict JPA mode) as the final vararg to a function
  4. *
* * @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(); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy