HHH-15761 Change some scopes for Hibernate Reactive

Make it possible for Hibernate Reactive to call or override some
methods.
This commit is contained in:
Davide D'Alto 2022-12-13 17:07:03 +00:00 committed by Davide D'Alto
parent e84bf71b7f
commit 20e7f1be9c
7 changed files with 47 additions and 27 deletions

View File

@ -72,6 +72,10 @@ public class CollectionLoaderSubSelectFetch implements CollectionLoader {
return attributeMapping;
}
protected SelectStatement getSqlAst() {
return sqlAst;
}
@Override
public PersistentCollection<?> load(Object triggerKey, SharedSessionContractImplementor session) {
final CollectionKey collectionKey = new CollectionKey( attributeMapping.getCollectionDescriptor(), triggerKey );

View File

@ -3293,11 +3293,11 @@ public abstract class AbstractEntityPersister
protected abstract boolean isIdentifierTable(String tableExpression);
private InsertCoordinator buildInsertCoordinator() {
protected InsertCoordinator buildInsertCoordinator() {
return new InsertCoordinator( this, factory );
}
private UpdateCoordinator buildUpdateCoordinator() {
protected UpdateCoordinator buildUpdateCoordinator() {
// we only have updates to issue for entities with one or more singular attributes
for ( AttributeMapping attributeMapping : attributeMappings ) {
if ( attributeMapping instanceof SingularAttributeMapping ) {
@ -3309,7 +3309,7 @@ public abstract class AbstractEntityPersister
return new UpdateCoordinatorNoOp( this );
}
private DeleteCoordinator buildDeleteCoordinator() {
protected DeleteCoordinator buildDeleteCoordinator() {
return new DeleteCoordinator( this, factory );
}

View File

@ -83,7 +83,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
}
}
private void doDynamicDelete(
protected void doDynamicDelete(
Object entity,
Object id,
Object rowId,
@ -134,7 +134,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
}
}
private void applyLocking(
protected void applyLocking(
Object version,
Object[] loadedState,
MutationExecutor mutationExecutor,
@ -205,7 +205,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
}
}
private void applyId(
protected void applyId(
Object id,
Object rowId,
MutationExecutor mutationExecutor,
@ -250,7 +250,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
} );
}
private void doStaticDelete(
protected void doStaticDelete(
Object entity,
Object id,
Object version,
@ -308,7 +308,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
mutationExecutor.release();
}
private MutationOperationGroup resolveNoVersionDeleteGroup(SharedSessionContractImplementor session) {
protected MutationOperationGroup resolveNoVersionDeleteGroup(SharedSessionContractImplementor session) {
if ( noVersionDeleteGroup == null ) {
noVersionDeleteGroup = generateOperationGroup( null, false, session );
}
@ -316,7 +316,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
return noVersionDeleteGroup;
}
private MutationOperationGroup generateOperationGroup(
protected MutationOperationGroup generateOperationGroup(
Object[] loadedState,
boolean applyVersion,
SharedSessionContractImplementor session) {

View File

@ -72,6 +72,10 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
return staticInsertGroup;
}
public BasicBatchKey getInsertBatchKey() {
return insertBatchKey;
}
/**
* Perform the insert(s).
*
@ -116,7 +120,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
}
}
private static class InsertValuesAnalysis implements ValuesAnalysis {
protected static class InsertValuesAnalysis implements ValuesAnalysis {
private final List<TableMapping> tablesWithNonNullValues = new ArrayList<>();
public InsertValuesAnalysis(EntityMutationTarget mutationTarget, Object[] values) {
@ -136,7 +140,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
}
}
private Object doStaticInserts(Object id, Object[] values, Object object, SharedSessionContractImplementor session) {
protected Object doStaticInserts(Object id, Object[] values, Object object, SharedSessionContractImplementor session) {
final InsertValuesAnalysis insertValuesAnalysis = new InsertValuesAnalysis( entityPersister(), values );
final TableInclusionChecker tableInclusionChecker = getTableInclusionChecker( insertValuesAnalysis );
@ -183,7 +187,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
}
}
private void decomposeForInsert(
protected void decomposeForInsert(
MutationExecutor mutationExecutor,
Object id,
Object[] values,
@ -259,7 +263,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
} );
}
private Object doDynamicInserts(Object id, Object[] values, Object object, SharedSessionContractImplementor session) {
protected Object doDynamicInserts(Object id, Object[] values, Object object, SharedSessionContractImplementor session) {
final boolean[] insertability = getPropertiesToInsert( values );
final MutationOperationGroup insertGroup = generateDynamicInsertSqlGroup( insertability );
@ -301,8 +305,8 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
}
}
private static TableInclusionChecker getTableInclusionChecker(InsertValuesAnalysis insertValuesAnalysis) {
return (tableMapping) -> !tableMapping.isOptional() || insertValuesAnalysis.hasNonNullBindings( tableMapping );
protected static TableInclusionChecker getTableInclusionChecker(InsertValuesAnalysis insertValuesAnalysis) {
return tableMapping -> !tableMapping.isOptional() || insertValuesAnalysis.hasNonNullBindings( tableMapping );
}
@ -319,7 +323,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
return notNull;
}
private MutationOperationGroup generateDynamicInsertSqlGroup(boolean[] insertable) {
protected MutationOperationGroup generateDynamicInsertSqlGroup(boolean[] insertable) {
assert entityPersister().getEntityMetamodel().isDynamicInsert();
final MutationGroupBuilder insertGroupBuilder = new MutationGroupBuilder( MutationType.INSERT, entityPersister() );

View File

@ -101,6 +101,14 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
return staticUpdateGroup;
}
protected MutationOperationGroup getVersionUpdateGroup() {
return versionUpdateGroup;
}
protected BatchKey getBatchKey() {
return batchKey;
}
public final boolean isModifiableEntity(EntityEntry entry) {
return ( entry == null ? entityPersister().isMutable() : entry.isModifiableEntity() );
}
@ -361,7 +369,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
: entityPersister().getPropertyUpdateability();
}
private void doVersionUpdate(
protected void doVersionUpdate(
Object entity,
Object id,
Object version,
@ -612,7 +620,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
}
private void doStaticUpdate(
protected void doStaticUpdate(
Object entity,
Object id,
Object rowId,
@ -663,7 +671,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
}
private void decomposeForUpdate(
protected void decomposeForUpdate(
Object id,
Object rowId,
Object[] values,
@ -789,7 +797,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
} );
}
private void doDynamicUpdate(
protected void doDynamicUpdate(
Object entity,
Object id,
Object rowId,
@ -866,7 +874,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
}
private MutationOperationGroup generateDynamicUpdateGroup(
protected MutationOperationGroup generateDynamicUpdateGroup(
Object id,
Object rowId,
Object[] oldValues,
@ -1041,7 +1049,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
* what SQL UPDATE statement(s) should be used to update the entity
* and to drive parameter binding
*/
private class UpdateValuesAnalysisImpl implements UpdateValuesAnalysis {
protected class UpdateValuesAnalysisImpl implements UpdateValuesAnalysis {
private final Object[] values;
private final int[] dirtyAttributeIndexes;
private final InclusionChecker dirtinessChecker;
@ -1451,12 +1459,12 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
}
@FunctionalInterface
private interface InclusionChecker {
protected interface InclusionChecker {
boolean include(int position, SingularAttributeMapping attribute);
}
@FunctionalInterface
private interface DirtinessChecker {
protected interface DirtinessChecker {
boolean isDirty(int position, AttributeMapping attribute);
}

View File

@ -343,6 +343,10 @@ public class NativeQueryImpl<R>
this.resultMappingSuppliedToCtor = true;
}
public List<ParameterOccurrence> getParameterOccurrences() {
return parameterOccurrences;
}
private ParameterInterpretation resolveParameterInterpretation(
String sqlString,
SharedSessionContractImplementor session) {
@ -614,7 +618,7 @@ public class NativeQueryImpl<R>
return resolveSelectQueryPlan().performList( this );
}
private SelectQueryPlan<R> resolveSelectQueryPlan() {
protected SelectQueryPlan<R> resolveSelectQueryPlan() {
if ( isCacheableQuery() ) {
final QueryInterpretationCache.Key cacheKey = generateSelectInterpretationsKey( resultSetMapping );
return getSession().getFactory().getQueryEngine().getInterpretationCache()
@ -659,7 +663,7 @@ public class NativeQueryImpl<R>
.createQueryPlan( queryDefinition, getSessionFactory() );
}
private String expandParameterLists() {
protected String expandParameterLists() {
if ( parameterOccurrences == null || parameterOccurrences.isEmpty() ) {
return sqlString;
}

View File

@ -63,7 +63,7 @@ public class SimpleDeleteQueryPlan implements NonSelectQueryPlan {
this.domainParameterXref = domainParameterXref;
}
private SqlAstTranslator<JdbcOperationQueryDelete> createDeleteTranslator(DomainQueryExecutionContext executionContext) {
protected SqlAstTranslator<JdbcOperationQueryDelete> createDeleteTranslator(DomainQueryExecutionContext executionContext) {
final SessionFactoryImplementor factory = executionContext.getSession().getFactory();
final QueryEngine queryEngine = factory.getQueryEngine();