Skip to content

move classes to correct package (instead of "iternal") #1705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.hibernate.reactive.mutiny.Mutiny.Query;
import org.hibernate.reactive.mutiny.Mutiny.SelectionQuery;
import org.hibernate.reactive.pool.ReactiveConnection;
import org.hibernate.reactive.query.sqm.iternal.ReactiveQuerySqmImpl;
import org.hibernate.reactive.query.sqm.internal.ReactiveQuerySqmImpl;
import org.hibernate.reactive.session.ReactiveConnectionSupplier;
import org.hibernate.reactive.session.ReactiveQueryProducer;
import org.hibernate.reactive.session.ReactiveSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.reactive.logging.impl.Log;
import org.hibernate.reactive.logging.impl.LoggerFactory;
import org.hibernate.reactive.query.sqm.iternal.AggregatedSelectReactiveQueryPlan;
import org.hibernate.reactive.query.sqm.iternal.ConcreteSqmSelectReactiveQueryPlan;
import org.hibernate.reactive.query.sqm.internal.AggregatedSelectReactiveQueryPlan;
import org.hibernate.reactive.query.sqm.internal.ConcreteSqmSelectReactiveQueryPlan;
import org.hibernate.reactive.query.sqm.spi.ReactiveSelectQueryPlan;
import org.hibernate.sql.results.internal.TupleMetadata;

Expand All @@ -52,9 +52,9 @@ public class ReactiveAbstractSelectionQuery<R> {

private final Supplier<QueryOptions> queryOptionsSupplier;

private SharedSessionContractImplementor session;
private final SharedSessionContractImplementor session;
private final Supplier<CompletionStage<List<R>>> doList;
private final Supplier<SqmStatement> getStatement;
private final Supplier<SqmStatement<?>> getStatement;

private final Supplier<TupleMetadata> getTupleMetadata;

Expand All @@ -66,7 +66,7 @@ public class ReactiveAbstractSelectionQuery<R> {
private final Runnable beforeQuery;

private final Consumer<Boolean> afterQuery;
private Function<List<R>, R> uniqueElement;
private final Function<List<R>, R> uniqueElement;
private final InterpretationsKeySource interpretationsKeySource;

// I'm sure we can avoid some of this by making some methods public in ORM,
Expand All @@ -75,7 +75,7 @@ public ReactiveAbstractSelectionQuery(
InterpretationsKeySource interpretationKeySource,
SharedSessionContractImplementor session,
Supplier<CompletionStage<List<R>>> doList,
Supplier<SqmStatement> getStatement,
Supplier<SqmStatement<?>> getStatement,
Supplier<TupleMetadata> getTupleMetadata,
Supplier<DomainParameterXref> getDomainParameterXref,
Supplier<Class<R>> getResultType,
Expand All @@ -98,40 +98,12 @@ public ReactiveAbstractSelectionQuery(
interpretationKeySource
);
}
//
// public ReactiveAbstractSelectionQuery(
// DomainQueryExecutionContext domainQueryExecutionContext,
// SharedSessionContractImplementor session,
// Supplier<CompletionStage<List<R>>> doList,
// Supplier<SqmStatement> getStatement,
// Supplier<TupleMetadata> getTupleMetadata,
// Supplier<DomainParameterXref> getDomainParameterXref,
// Supplier<Class<R>> getResultType,
// Supplier<String> getQueryString,
// Runnable beforeQuery,
// Consumer<Boolean> afterQuery,
// Function<List<R>, R> uniqueElement) {
// this(
// domainQueryExecutionContext::getQueryOptions,
// session,
// doList,
// getStatement,
// getTupleMetadata,
// getDomainParameterXref,
// getResultType,
// getQueryString,
// beforeQuery,
// afterQuery,
// uniqueElement,
// null
// );
// }

public ReactiveAbstractSelectionQuery(
Supplier<QueryOptions> queryOptionsSupplier,
SharedSessionContractImplementor session,
Supplier<CompletionStage<List<R>>> doList,
Supplier<SqmStatement> getStatement,
Supplier<SqmStatement<?>> getStatement,
Supplier<TupleMetadata> getTupleMetadata,
Supplier<DomainParameterXref> getDomainParameterXref,
Supplier<Class<R>> getResultType,
Expand Down Expand Up @@ -292,7 +264,7 @@ private CompletionStage<List<R>> doReactiveList() {
return doList.get();
}

public SqmStatement getSqmStatement() {
public SqmStatement<?> getSqmStatement() {
return getStatement.get();
}

Expand Down Expand Up @@ -329,7 +301,7 @@ public List<R> list() {
}

public Stream<R> getResultStream() {
throw LOG.nonReactiveMethodCall( "<no alterative>" );
throw LOG.nonReactiveMethodCall( "<no alternative>" );
}

public R uniqueResult() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.hibernate.reactive.logging.impl.LoggerFactory;
import org.hibernate.reactive.query.sqm.spi.ReactiveSelectQueryPlan;

public interface ReactiveNativeSelectQueryPlan<T> extends NativeSelectQueryPlan, ReactiveSelectQueryPlan {
public interface ReactiveNativeSelectQueryPlan<T> extends NativeSelectQueryPlan<T>, ReactiveSelectQueryPlan<T> {
Log LOG = LoggerFactory.make( Log.class, MethodHandles.lookup() );

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ public class ReactiveNativeQueryImpl<R> extends NativeQueryImpl<R>

private final ReactiveAbstractSelectionQuery<R> selectionQueryDelegate;

public ReactiveNativeQueryImpl(String memento, SharedSessionContractImplementor session, String[] querySpaces) {
this( memento, session );
addQuerySpaces( querySpaces );
}

public ReactiveNativeQueryImpl(String memento, SharedSessionContractImplementor session) {
super( memento, session );
this.selectionQueryDelegate = createSelectionQueryDelegate( session );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
import static java.util.Collections.emptyList;
import static org.hibernate.reactive.util.impl.CompletionStages.completedFuture;

public class ReactiveNativeSelectQueryPlanImpl<R> extends NativeSelectQueryPlanImpl implements ReactiveNativeSelectQueryPlan {
public class ReactiveNativeSelectQueryPlanImpl<R> extends NativeSelectQueryPlanImpl<R> implements ReactiveNativeSelectQueryPlan<R> {

private final Set<String> affectedTableNames;
private String sql;
private final String sql;
private final List<ParameterOccurrence> parameterList;
private final JdbcValuesMappingProducer resultSetMapping;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
import org.hibernate.query.sqm.spi.NamedSqmQueryMemento;
import org.hibernate.query.sqm.tree.SqmStatement;
import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.reactive.query.sqm.iternal.ReactiveQuerySqmImpl;
import org.hibernate.reactive.query.sqm.iternal.ReactiveSqmSelectionQueryImpl;
import org.hibernate.reactive.query.sqm.internal.ReactiveQuerySqmImpl;
import org.hibernate.reactive.query.sqm.internal.ReactiveSqmSelectionQueryImpl;

/**
* @see org.hibernate.query.sql.spi.NamedNativeQueryMemento
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -119,10 +119,10 @@ public ScrollableResultsImplementor<R> performScroll(ScrollMode scrollMode, Doma
public CompletionStage<List<R>> reactivePerformList(DomainQueryExecutionContext executionContext) {
return executionContext.getQueryOptions().getEffectiveLimit().getMaxRowsJpa() == 0
? completedFuture( emptyList() )
: withCacheableSqmInterpretation( executionContext, null, listInterpreter );
: withCacheableSqmInterpretation( executionContext, listInterpreter );
}

private <T, X> CompletionStage<T> withCacheableSqmInterpretation(DomainQueryExecutionContext executionContext, X context, SqmInterpreter<T, X> interpreter) {
private <T, X> CompletionStage<T> withCacheableSqmInterpretation(DomainQueryExecutionContext executionContext, SqmInterpreter<T, X> interpreter) {
// NOTE : VERY IMPORTANT - intentional double-lock checking
// The other option would be to leverage `java.util.concurrent.locks.ReadWriteLock`
// to protect access. However, synchronized is much simpler here. We will verify
Expand Down Expand Up @@ -162,7 +162,7 @@ private <T, X> CompletionStage<T> withCacheableSqmInterpretation(DomainQueryExec
jdbcParameterBindings = createJdbcParameterBindings( localCopy, executionContext );
}

return interpreter.interpret( context, executionContext, localCopy, jdbcParameterBindings );
return interpreter.interpret( null, executionContext, localCopy, jdbcParameterBindings );
}

private JdbcParameterBindings createJdbcParameterBindings(CacheableSqmInterpretation sqmInterpretation, DomainQueryExecutionContext executionContext) {
Expand Down Expand Up @@ -296,13 +296,5 @@ Map<QueryParameterImplementor<?>, Map<SqmParameter<?>, List<JdbcParametersList>>
public Map<SqmParameter<?>, MappingModelExpressible<?>> getSqmParameterMappingModelTypes() {
return sqmParameterMappingModelTypes;
}

JdbcParameterBindings getFirstParameterBindings() {
return firstParameterBindings;
}

void setFirstParameterBindings(JdbcParameterBindings firstParameterBindings) {
this.firstParameterBindings = firstParameterBindings;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.util.concurrent.CompletionStage;

Expand All @@ -18,12 +18,12 @@
* @see org.hibernate.query.sqm.internal.MultiTableDeleteQueryPlan
*/
public class ReactiveMultiTableDeleteQueryPlan implements ReactiveNonSelectQueryPlan {
private final SqmDeleteStatement sqmDelete;
private final SqmDeleteStatement<?> sqmDelete;
private final DomainParameterXref domainParameterXref;
private final ReactiveSqmMultiTableMutationStrategy deleteStrategy;

public ReactiveMultiTableDeleteQueryPlan(
SqmDeleteStatement sqmDelete,
SqmDeleteStatement<?> sqmDelete,
DomainParameterXref domainParameterXref,
ReactiveSqmMultiTableMutationStrategy deleteStrategy) {
this.sqmDelete = sqmDelete;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.util.concurrent.CompletionStage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.util.concurrent.CompletionStage;

Expand All @@ -18,12 +18,12 @@
* @see org.hibernate.query.sqm.internal.MultiTableUpdateQueryPlan
*/
public class ReactiveMultiTableUpdateQueryPlan implements ReactiveNonSelectQueryPlan {
private final SqmUpdateStatement sqmUpdate;
private final SqmUpdateStatement<?> sqmUpdate;
private final DomainParameterXref domainParameterXref;
private final ReactiveSqmMultiTableMutationStrategy mutationStrategy;

public ReactiveMultiTableUpdateQueryPlan(
SqmUpdateStatement sqmUpdate,
SqmUpdateStatement<?> sqmUpdate,
DomainParameterXref domainParameterXref,
ReactiveSqmMultiTableMutationStrategy mutationStrategy) {
this.sqmUpdate = sqmUpdate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.lang.invoke.MethodHandles;
import java.time.Instant;
Expand Down Expand Up @@ -57,7 +57,6 @@
import org.hibernate.reactive.logging.impl.LoggerFactory;
import org.hibernate.reactive.query.spi.ReactiveAbstractSelectionQuery;
import org.hibernate.reactive.query.sql.spi.ReactiveNonSelectQueryPlan;
import org.hibernate.reactive.query.sqm.internal.ReactiveAggregatedNonSelectQueryPlan;
import org.hibernate.reactive.query.sqm.mutation.spi.ReactiveSqmMultiTableInsertStrategy;
import org.hibernate.reactive.query.sqm.mutation.spi.ReactiveSqmMultiTableMutationStrategy;
import org.hibernate.reactive.query.sqm.spi.ReactiveSelectQueryPlan;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.sql.PreparedStatement;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;


import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletionStage;

import org.hibernate.action.internal.BulkOperationCleanupAction;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.metamodel.mapping.MappingModelExpressible;
Expand Down Expand Up @@ -62,8 +61,6 @@ public ReactiveSimpleInsertQueryPlan(
public CompletionStage<Integer> executeReactiveUpdate(DomainQueryExecutionContext executionContext) {
BulkOperationCleanupAction.schedule( executionContext.getSession(), sqmInsert );
final SharedSessionContractImplementor session = executionContext.getSession();
final SessionFactoryImplementor factory = session.getFactory();
final JdbcServices jdbcServices = factory.getJdbcServices();
SqlAstTranslator<JdbcOperationQueryInsert> insertTranslator = null;
if ( jdbcInsert == null ) {
insertTranslator = createInsertTranslator( executionContext );
Expand All @@ -73,7 +70,7 @@ public CompletionStage<Integer> executeReactiveUpdate(DomainQueryExecutionContex
executionContext.getQueryParameterBindings(),
domainParameterXref,
jdbcParamsXref,
factory.getRuntimeMetamodels().getMappingMetamodel(),
session.getFactory().getRuntimeMetamodels().getMappingMetamodel(),
tableGroupAccess::findTableGroup,
new SqmParameterMappingModelResolutionAccess() {
@Override @SuppressWarnings("unchecked")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
* Copyright: Red Hat Inc. and Hibernate Authors
*/
package org.hibernate.reactive.query.sqm.iternal;
package org.hibernate.reactive.query.sqm.internal;

import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -57,7 +57,6 @@ public ReactiveSimpleUpdateQueryPlan(SqmUpdateStatement<?> sqmUpdate, DomainPara
public CompletionStage<Integer> executeReactiveUpdate(DomainQueryExecutionContext executionContext) {
BulkOperationCleanupAction.schedule( executionContext.getSession(), sqmUpdate );
final SharedSessionContractImplementor session = executionContext.getSession();
final SessionFactoryImplementor factory = session.getFactory();
SqlAstTranslator<JdbcOperationQueryUpdate> updateTranslator = null;
if ( jdbcUpdate == null ) {
updateTranslator = createUpdateTranslator( executionContext );
Expand All @@ -67,7 +66,7 @@ public CompletionStage<Integer> executeReactiveUpdate(DomainQueryExecutionContex
executionContext.getQueryParameterBindings(),
domainParameterXref,
jdbcParamsXref,
factory.getRuntimeMetamodels().getMappingMetamodel(),
session.getFactory().getRuntimeMetamodels().getMappingMetamodel(),
tableGroupAccess::findTableGroup,
new SqmParameterMappingModelResolutionAccess() {
@Override
Expand Down
Loading