org.hibernate.metamodel.model.domain.AllowableOutputParameterType 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.metamodel.model.domain;
import java.sql.CallableStatement;
import java.sql.SQLException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
/**
* Specialization of DomainType for types that can be used as a
* parameter output for a {@link org.hibernate.procedure.ProcedureCall}
*
* @apiNote We assume a type that maps to exactly one SQL value, hence {@link #getSqlTypeDescriptor()}
*
* @author Steve Ebersole
*/
public interface AllowableOutputParameterType extends AllowableParameterType {
/**
* Can the given instance of this type actually perform the parameter value extractions?
*
* @return {@code true} indicates that {@link #extract} calls will not fail due to {@link IllegalStateException}.
*/
boolean canDoExtraction();
/**
* Descriptor for the SQL type mapped by this type.
*/
SqlTypeDescriptor getSqlTypeDescriptor();
/**
* Perform the extraction
*
* @param statement The CallableStatement from which to extract the parameter value(s).
* @param paramIndex The parameter index from which to extract
* @param session The originating session
*
* @return The extracted value.
*
* @throws SQLException Indicates an issue calling into the CallableStatement
* @throws IllegalStateException Thrown if this method is called on instances that return {@code false} for {@link #canDoExtraction}
*/
J extract(CallableStatement statement, int paramIndex, SharedSessionContractImplementor session) throws SQLException;
/**
* Perform the extraction
*
* @param statement The CallableStatement from which to extract the parameter value(s).
* @param paramName The parameter names.
* @param session The originating session
*
* @return The extracted value.
*
* @throws SQLException Indicates an issue calling into the CallableStatement
* @throws IllegalStateException Thrown if this method is called on instances that return {@code false} for {@link #canDoExtraction}
*/
J extract(CallableStatement statement, String paramName, SharedSessionContractImplementor session) throws SQLException;
}