Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion design/sqm.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ represents an atomic piece of the query. E.g. `SqmSelectClause` represents the
`SqmSelectClause` is ultimately a collection of one or more `SqmSelection` references representing the individual
selections to be returned from the query (called the domain results). Etc

All of these details are handled by the `QuerySqmImpl` implementation of `Query`. This is what Hibernate
All of these details are handled by the `SqmQueryImpl` implementation of `Query`. This is what Hibernate
uses for both HQL and Criteria queries.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
import org.hibernate.query.sql.spi.NativeQueryImplementor;
import org.hibernate.query.sqm.SqmSelectionQuery;
import org.hibernate.query.sqm.internal.QuerySqmImpl;
import org.hibernate.query.sqm.internal.SqmQueryImpl;
import org.hibernate.query.sqm.internal.SqmSelectionQueryImpl;
import org.hibernate.query.sqm.spi.NamedSqmQueryMemento;
import org.hibernate.query.sqm.tree.SqmDmlStatement;
Expand Down Expand Up @@ -888,7 +888,7 @@ public <T> QueryImplementor<T> createQuery(String queryString, Class<T> expected
checksBeforeQueryCreation();
try {
final HqlInterpretation<T> interpretation = interpretHql( queryString, expectedResultType );
final QuerySqmImpl<T> query = new QuerySqmImpl<>( queryString, interpretation, expectedResultType, this );
final SqmQueryImpl<T> query = new SqmQueryImpl<>( queryString, interpretation, expectedResultType, this );
applyQuerySettingsAndHints( query );
query.setComment( queryString );
return query;
Expand All @@ -904,11 +904,11 @@ public <R> QueryImplementor<R> createQuery(TypedQueryReference<R> typedQueryRefe
checksBeforeQueryCreation();
if ( typedQueryReference instanceof SelectionSpecificationImpl<R> specification ) {
final CriteriaQuery<R> query = specification.buildCriteria( getCriteriaBuilder() );
return new QuerySqmImpl<>( (SqmStatement<R>) query, specification.getResultType(), this );
return new SqmQueryImpl<>( (SqmStatement<R>) query, specification.getResultType(), this );
}
else if ( typedQueryReference instanceof MutationSpecificationImpl<?> specification ) {
final CommonAbstractCriteria query = specification.buildCriteria( getCriteriaBuilder() );
return new QuerySqmImpl<>( (SqmStatement<R>) query, (Class<R>) specification.getResultType(), this );
return new SqmQueryImpl<>( (SqmStatement<R>) query, (Class<R>) specification.getResultType(), this );
}
else {
@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -1502,7 +1502,7 @@ public QueryImplementor<?> createQuery(@SuppressWarnings("rawtypes") CriteriaDel
}

protected <T> QueryImplementor<T> createCriteriaQuery(SqmStatement<T> criteria, Class<T> resultType) {
final QuerySqmImpl<T> query = new QuerySqmImpl<>( criteria, resultType, this );
final SqmQueryImpl<T> query = new SqmQueryImpl<>( criteria, resultType, this );
applyQuerySettingsAndHints( query );
return query;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.hibernate.query.named.AbstractNamedQueryMemento;
import org.hibernate.query.spi.QueryEngine;
import org.hibernate.query.sqm.SqmSelectionQuery;
import org.hibernate.query.sqm.internal.QuerySqmImpl;
import org.hibernate.query.sqm.internal.SqmQueryImpl;
import org.hibernate.query.sqm.internal.SqmSelectionQueryImpl;
import org.hibernate.query.sqm.spi.NamedSqmQueryMemento;
import org.hibernate.query.sqm.tree.SqmStatement;
Expand Down Expand Up @@ -89,7 +89,7 @@ public <T> SqmQueryImplementor<T> toQuery(SharedSessionContractImplementor sessi
}
@SuppressWarnings("unchecked") // we just checked the result type
final SqmStatement<T> statement = (SqmStatement<T>) sqmStatement;
return new QuerySqmImpl<>( this, statement, resultType, session );
return new SqmQueryImpl<>( this, statement, resultType, session );
}

@Override
Expand All @@ -110,7 +110,7 @@ public <T> SqmSelectionQuery<T> toSelectionQuery(Class<T> resultType, SharedSess

@Override
public String getHqlString() {
return QuerySqmImpl.CRITERIA_HQL_STRING;
return SqmQueryImpl.CRITERIA_HQL_STRING;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import org.hibernate.query.named.AbstractNamedQueryMemento;
import org.hibernate.query.spi.QueryEngine;
import org.hibernate.query.sqm.SqmSelectionQuery;
import org.hibernate.query.sqm.internal.QuerySqmImpl;
import org.hibernate.query.sqm.internal.SqmQueryImpl;
import org.hibernate.query.sqm.internal.SqmSelectionQueryImpl;
import org.hibernate.query.sqm.spi.NamedSqmQueryMemento;
import org.hibernate.query.sqm.tree.SqmStatement;
Expand Down Expand Up @@ -147,6 +147,6 @@ public SqmStatement<R> getSqmStatement() {

@Override
public <T> SqmQueryImplementor<T> toQuery(SharedSessionContractImplementor session, Class<T> resultType) {
return new QuerySqmImpl<>( this, resultType, session );
return new SqmQueryImpl<>( this, resultType, session );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.hibernate.query.spi.QueryImplementor;
import org.hibernate.query.spi.SqmQuery;
import org.hibernate.query.sqm.spi.NamedSqmQueryMemento;
import org.hibernate.query.sqm.tree.SqmStatement;
import org.hibernate.transform.ResultTransformer;

import jakarta.persistence.FlushModeType;
Expand All @@ -39,17 +38,13 @@
*
* @author Steve Ebersole
*/
public interface SqmQueryImplementor<R> extends QueryImplementor<R>, SqmQuery, NameableQuery {
public interface SqmQueryImplementor<R> extends QueryImplementor<R>, SqmQuery<R>, NameableQuery {
@Override
NamedSqmQueryMemento<R> toMemento(String name);

@Override
ParameterMetadataImplementor getParameterMetadata();

@Override
SqmStatement<R> getSqmStatement();


// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// covariance

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.hibernate.query.spi.QueryEngine;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.query.sqm.SqmQuerySource;
import org.hibernate.query.sqm.internal.QuerySqmImpl;
import org.hibernate.query.sqm.internal.SqmQueryImpl;
import org.hibernate.query.sqm.internal.SqmUtil;
import org.hibernate.query.sqm.tree.AbstractSqmDmlStatement;
import org.hibernate.query.sqm.tree.SqmDeleteOrUpdateStatement;
Expand Down Expand Up @@ -124,7 +124,7 @@ public MutationQuery createQuery(StatelessSession session) {
public MutationQuery createQuery(SharedSessionContract session) {
final var sessionImpl = session.unwrap(SharedSessionContractImplementor.class);
final SqmDeleteOrUpdateStatement<T> sqmStatement = build( sessionImpl.getFactory().getQueryEngine() );
return new QuerySqmImpl<>( sqmStatement, true, null, sessionImpl );
return new SqmQueryImpl<>( sqmStatement, true, null, sessionImpl );
}

private SqmDeleteOrUpdateStatement<T> build(QueryEngine queryEngine) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,15 @@
import static org.hibernate.jpa.internal.util.LockModeTypeHelper.interpretLockMode;

/**
* Base implementation of {@link CommonQueryContract}.
*
* @apiNote This class is now considered internal implementation
* and will move to an internal package in a future version.
* Application programs should never depend directly on this class.
*
* @author Steve Ebersole
*/
@Internal
public abstract class AbstractCommonQueryContract implements CommonQueryContract {
private final SharedSessionContractImplementor session;
private final QueryOptionsImpl queryOptions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import jakarta.persistence.Timeout;
import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.Internal;
import org.hibernate.query.QueryFlushMode;
import org.hibernate.HibernateException;
import org.hibernate.LockMode;
Expand Down Expand Up @@ -62,8 +63,15 @@
import static org.hibernate.jpa.SpecHints.HINT_SPEC_QUERY_TIMEOUT;

/**
* Base implementation of {@link org.hibernate.query.Query}.
*
* @apiNote This class is now considered internal implementation
* and will move to an internal package in a future version.
* Application programs should never depend directly on this class.
*
* @author Steve Ebersole
*/
@Internal
public abstract class AbstractQuery<R>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @gavinking

Should this really become an internal class? Hibernate Search extends it in a few places ... can we keep it an spi as it is now ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah OK, sure, fine. I should have checked.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks 🙂

extends AbstractSelectionQuery<R>
implements QueryImplementor<R> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@
package org.hibernate.query.spi;


import org.hibernate.Internal;
import org.hibernate.type.BindableType;

import static org.hibernate.query.QueryLogging.QUERY_MESSAGE_LOGGER;

/**
* Base implementation of {@link org.hibernate.query.QueryParameter}.
*
* @apiNote This class is now considered internal implementation
* and will move to an internal package in a future version.
* Application programs should never depend directly on this class.
*
* @author Steve Ebersole
*/
@Internal
public abstract class AbstractQueryParameter<T> implements QueryParameterImplementor<T> {

private boolean allowMultiValuedBinding;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import jakarta.persistence.Timeout;
import org.hibernate.CacheMode;
import org.hibernate.FlushMode;
import org.hibernate.Internal;
import org.hibernate.ScrollableResults;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.query.QueryFlushMode;
Expand Down Expand Up @@ -67,8 +68,15 @@
import static org.hibernate.jpa.HibernateHints.HINT_READ_ONLY;

/**
* Base implementation of {@link SelectionQuery}.
*
* @apiNote This class is now considered internal implementation
* and will move to an internal package in a future version.
* Application programs should never depend directly on this class.
*
* @author Steve Ebersole
*/
@Internal
public abstract class AbstractSelectionQuery<R>
extends AbstractCommonQueryContract
implements SelectionQuery<R>, DomainQueryExecutionContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import java.util.concurrent.ConcurrentHashMap;

import org.hibernate.Internal;
import org.hibernate.query.sqm.internal.DomainParameterXref;
import org.hibernate.query.sqm.tree.SqmStatement;
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
Expand All @@ -14,8 +15,15 @@
import static org.hibernate.query.sqm.internal.SqmUtil.isResultTypeAlwaysAllowed;

/**
* Default implementation if {@link HqlInterpretation}.
*
* @apiNote This class is now considered internal implementation
* and will move to an internal package in a future version.
* Application programs should never depend directly on this class.
*
* @author Steve Ebersole
*/
@Internal
public class SimpleHqlInterpretationImpl<R> implements HqlInterpretation<R> {
private final SqmStatement<R> sqmStatement;
private final ParameterMetadataImplementor parameterMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
*/
package org.hibernate.query.spi;

import org.hibernate.Internal;
import org.hibernate.LockOptions;
import org.hibernate.sql.exec.spi.JdbcOperationQuerySelect;
import org.hibernate.sql.results.spi.ListResultsConsumer;

/**
* @apiNote This class is considered internal implementation
* and will move to an internal package in a future version.
* Application programs should never depend directly on this class.
*
* @author Christian Beikov
*/
@Internal
public class SqlOmittingQueryOptions extends DelegatingQueryOptions {

private final boolean omitLimit;
Expand Down
Loading
Loading