SelectQuery, MutationQuery, etc

This commit is contained in:
Steve Ebersole 2022-01-21 13:26:02 -06:00
parent 233470efdb
commit 9234aff3ec
7 changed files with 6 additions and 152 deletions

View File

@ -42,7 +42,6 @@ import org.hibernate.jdbc.ReturningWork;
import org.hibernate.jdbc.Work;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.procedure.ProcedureCall;
import org.hibernate.query.MutationNativeQuery;
import org.hibernate.query.MutationQuery;
import org.hibernate.query.SelectionQuery;
import org.hibernate.query.criteria.HibernateCriteriaBuilder;
@ -551,7 +550,7 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
}
@Override
public MutationNativeQuery createNativeMutationQuery(String sqlString) {
public MutationQuery createNativeMutationQuery(String sqlString) {
return delegate.createNativeMutationQuery( sqlString );
}

View File

@ -54,7 +54,6 @@ import org.hibernate.procedure.spi.NamedCallableQueryMemento;
import org.hibernate.query.IllegalMutationQueryException;
import org.hibernate.query.IllegalNamedQueryOptionsException;
import org.hibernate.query.JpaQuery;
import org.hibernate.query.MutationNativeQuery;
import org.hibernate.query.MutationQuery;
import org.hibernate.query.SelectionQuery;
import org.hibernate.query.UnknownNamedQueryException;
@ -976,7 +975,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
}
@Override
public MutationNativeQuery createNativeMutationQuery(String sqlString) {
public MutationQuery createNativeMutationQuery(String sqlString) {
final NativeQueryImplementor<?> query = createNativeQuery( sqlString );
if ( query.isSelectQuery() == TRUE ) {
throw new IllegalMutationQueryException( "Expecting a native mutation query, but found `" + sqlString + "`" );

View File

@ -1,143 +0,0 @@
/*
* 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;
import java.time.Instant;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import org.hibernate.FlushMode;
import jakarta.persistence.Parameter;
import jakarta.persistence.TemporalType;
/**
* @author Steve Ebersole
*/
public interface MutationNativeQuery extends MutationQuery {
@Override
MutationNativeQuery setParameter(String name, Object value);
@Override
<P> MutationNativeQuery setParameter(String name, P value, Class<P> type);
@Override
<P> MutationNativeQuery setParameter(String name, P value, BindableType<P> type);
@Override
MutationNativeQuery setParameter(String name, Instant value, TemporalType temporalType);
@Override
MutationNativeQuery setParameter(String name, Calendar value, TemporalType temporalType);
@Override
MutationNativeQuery setParameter(String name, Date value, TemporalType temporalType);
@Override
MutationNativeQuery setParameter(int position, Object value);
@Override
<P> MutationNativeQuery setParameter(int position, P value, Class<P> type);
@Override
<P> MutationNativeQuery setParameter(int position, P value, BindableType<P> type);
@Override
MutationNativeQuery setParameter(int position, Instant value, TemporalType temporalType);
@Override
MutationNativeQuery setParameter(int position, Date value, TemporalType temporalType);
@Override
MutationNativeQuery setParameter(int position, Calendar value, TemporalType temporalType);
@Override
<T> MutationNativeQuery setParameter(QueryParameter<T> parameter, T value);
@Override
<P> MutationNativeQuery setParameter(QueryParameter<P> parameter, P value, Class<P> type);
@Override
<P> MutationNativeQuery setParameter(QueryParameter<P> parameter, P val, BindableType<P> type);
@Override
<T> MutationNativeQuery setParameter(Parameter<T> param, T value);
@Override
MutationNativeQuery setParameter(Parameter<Calendar> param, Calendar value, TemporalType temporalType);
@Override
MutationNativeQuery setParameter(Parameter<Date> param, Date value, TemporalType temporalType);
@Override
MutationNativeQuery setParameterList(String name, @SuppressWarnings("rawtypes") Collection values);
@Override
<P> MutationNativeQuery setParameterList(String name, Collection<? extends P> values, Class<P> javaType);
@Override
<P> MutationNativeQuery setParameterList(String name, Collection<? extends P> values, BindableType<P> type);
@Override
MutationNativeQuery setParameterList(String name, Object[] values);
@Override
<P> MutationNativeQuery setParameterList(String name, P[] values, Class<P> javaType);
@Override
<P> MutationNativeQuery setParameterList(String name, P[] values, BindableType<P> type);
@Override
MutationNativeQuery setParameterList(int position, @SuppressWarnings("rawtypes") Collection values);
@Override
<P> MutationNativeQuery setParameterList(int position, Collection<? extends P> values, Class<P> javaType);
@Override
<P> MutationNativeQuery setParameterList(int position, Collection<? extends P> values, BindableType<P> type);
@Override
MutationNativeQuery setParameterList(int position, Object[] values);
@Override
<P> MutationNativeQuery setParameterList(int position, P[] values, Class<P> javaType);
@Override
<P> MutationNativeQuery setParameterList(int position, P[] values, BindableType<P> type);
@Override
<P> MutationNativeQuery setParameterList(QueryParameter<P> parameter, Collection<? extends P> values);
@Override
<P> MutationNativeQuery setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType);
@Override
<P> MutationNativeQuery setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, BindableType<P> type);
@Override
<P> MutationNativeQuery setParameterList(QueryParameter<P> parameter, P[] values);
@Override
<P> MutationNativeQuery setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType);
@Override
<P> MutationNativeQuery setParameterList(QueryParameter<P> parameter, P[] values, BindableType<P> type);
@Override
MutationNativeQuery setProperties(Object bean);
@Override
MutationNativeQuery setProperties(Map bean);
@Override
MutationNativeQuery setHibernateFlushMode(FlushMode flushMode);
@Override
MutationNativeQuery setTimeout(int timeout);
}

View File

@ -62,7 +62,7 @@ import org.hibernate.type.BasicTypeReference;
* @author Gavin King
* @author Steve Ebersole
*/
public interface NativeQuery<T> extends Query<T>, MutationNativeQuery, SynchronizeableQuery {
public interface NativeQuery<T> extends Query<T>, SynchronizeableQuery {
/**
* Declare a scalar query result. Hibernate will attempt to automatically
* detect the underlying type.

View File

@ -48,7 +48,7 @@ import jakarta.persistence.TypedQuery;
* @param <R> The query result type, for typed queries, or {@code Object} for untyped queries
*/
@Incubating
public interface Query<R> extends SelectionQuery, JpaQuery, TypedQuery<R> {
public interface Query<R> extends SelectionQuery, MutationQuery, JpaQuery, TypedQuery<R> {
/**
* Execute the query and return the query results as a {@link List}.

View File

@ -204,7 +204,7 @@ public interface QueryProducer {
*
* @return The NativeQuery instance for manipulation and execution
*/
MutationNativeQuery createNativeMutationQuery(String sqlString);
MutationQuery createNativeMutationQuery(String sqlString);
/**
* Create a `MutationQuery` from the given update criteria tree

View File

@ -9,7 +9,6 @@ package org.hibernate.query.spi;
import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.query.MutationNativeQuery;
import org.hibernate.query.MutationQuery;
import org.hibernate.query.QueryProducer;
import org.hibernate.query.sql.spi.NativeQueryImplementor;
@ -75,7 +74,7 @@ public interface QueryProducerImplementor extends QueryProducer {
MutationQuery createNamedMutationQuery(String name);
@Override
MutationNativeQuery createNativeMutationQuery(String sqlString);
MutationQuery createNativeMutationQuery(String sqlString);
@Override
MutationQuery createMutationQuery(@SuppressWarnings("rawtypes") CriteriaUpdate updateQuery);