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:
parent
e84bf71b7f
commit
20e7f1be9c
|
@ -72,6 +72,10 @@ public class CollectionLoaderSubSelectFetch implements CollectionLoader {
|
||||||
return attributeMapping;
|
return attributeMapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected SelectStatement getSqlAst() {
|
||||||
|
return sqlAst;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PersistentCollection<?> load(Object triggerKey, SharedSessionContractImplementor session) {
|
public PersistentCollection<?> load(Object triggerKey, SharedSessionContractImplementor session) {
|
||||||
final CollectionKey collectionKey = new CollectionKey( attributeMapping.getCollectionDescriptor(), triggerKey );
|
final CollectionKey collectionKey = new CollectionKey( attributeMapping.getCollectionDescriptor(), triggerKey );
|
||||||
|
|
|
@ -3293,11 +3293,11 @@ public abstract class AbstractEntityPersister
|
||||||
|
|
||||||
protected abstract boolean isIdentifierTable(String tableExpression);
|
protected abstract boolean isIdentifierTable(String tableExpression);
|
||||||
|
|
||||||
private InsertCoordinator buildInsertCoordinator() {
|
protected InsertCoordinator buildInsertCoordinator() {
|
||||||
return new InsertCoordinator( this, factory );
|
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
|
// we only have updates to issue for entities with one or more singular attributes
|
||||||
for ( AttributeMapping attributeMapping : attributeMappings ) {
|
for ( AttributeMapping attributeMapping : attributeMappings ) {
|
||||||
if ( attributeMapping instanceof SingularAttributeMapping ) {
|
if ( attributeMapping instanceof SingularAttributeMapping ) {
|
||||||
|
@ -3309,7 +3309,7 @@ public abstract class AbstractEntityPersister
|
||||||
return new UpdateCoordinatorNoOp( this );
|
return new UpdateCoordinatorNoOp( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
private DeleteCoordinator buildDeleteCoordinator() {
|
protected DeleteCoordinator buildDeleteCoordinator() {
|
||||||
return new DeleteCoordinator( this, factory );
|
return new DeleteCoordinator( this, factory );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDynamicDelete(
|
protected void doDynamicDelete(
|
||||||
Object entity,
|
Object entity,
|
||||||
Object id,
|
Object id,
|
||||||
Object rowId,
|
Object rowId,
|
||||||
|
@ -134,7 +134,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyLocking(
|
protected void applyLocking(
|
||||||
Object version,
|
Object version,
|
||||||
Object[] loadedState,
|
Object[] loadedState,
|
||||||
MutationExecutor mutationExecutor,
|
MutationExecutor mutationExecutor,
|
||||||
|
@ -205,7 +205,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyId(
|
protected void applyId(
|
||||||
Object id,
|
Object id,
|
||||||
Object rowId,
|
Object rowId,
|
||||||
MutationExecutor mutationExecutor,
|
MutationExecutor mutationExecutor,
|
||||||
|
@ -250,7 +250,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doStaticDelete(
|
protected void doStaticDelete(
|
||||||
Object entity,
|
Object entity,
|
||||||
Object id,
|
Object id,
|
||||||
Object version,
|
Object version,
|
||||||
|
@ -308,7 +308,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
||||||
mutationExecutor.release();
|
mutationExecutor.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
private MutationOperationGroup resolveNoVersionDeleteGroup(SharedSessionContractImplementor session) {
|
protected MutationOperationGroup resolveNoVersionDeleteGroup(SharedSessionContractImplementor session) {
|
||||||
if ( noVersionDeleteGroup == null ) {
|
if ( noVersionDeleteGroup == null ) {
|
||||||
noVersionDeleteGroup = generateOperationGroup( null, false, session );
|
noVersionDeleteGroup = generateOperationGroup( null, false, session );
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ public class DeleteCoordinator extends AbstractMutationCoordinator {
|
||||||
return noVersionDeleteGroup;
|
return noVersionDeleteGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MutationOperationGroup generateOperationGroup(
|
protected MutationOperationGroup generateOperationGroup(
|
||||||
Object[] loadedState,
|
Object[] loadedState,
|
||||||
boolean applyVersion,
|
boolean applyVersion,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
|
|
@ -72,6 +72,10 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
|
||||||
return staticInsertGroup;
|
return staticInsertGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BasicBatchKey getInsertBatchKey() {
|
||||||
|
return insertBatchKey;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the insert(s).
|
* 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<>();
|
private final List<TableMapping> tablesWithNonNullValues = new ArrayList<>();
|
||||||
|
|
||||||
public InsertValuesAnalysis(EntityMutationTarget mutationTarget, Object[] values) {
|
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 InsertValuesAnalysis insertValuesAnalysis = new InsertValuesAnalysis( entityPersister(), values );
|
||||||
|
|
||||||
final TableInclusionChecker tableInclusionChecker = getTableInclusionChecker( insertValuesAnalysis );
|
final TableInclusionChecker tableInclusionChecker = getTableInclusionChecker( insertValuesAnalysis );
|
||||||
|
@ -183,7 +187,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decomposeForInsert(
|
protected void decomposeForInsert(
|
||||||
MutationExecutor mutationExecutor,
|
MutationExecutor mutationExecutor,
|
||||||
Object id,
|
Object id,
|
||||||
Object[] values,
|
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 boolean[] insertability = getPropertiesToInsert( values );
|
||||||
final MutationOperationGroup insertGroup = generateDynamicInsertSqlGroup( insertability );
|
final MutationOperationGroup insertGroup = generateDynamicInsertSqlGroup( insertability );
|
||||||
|
|
||||||
|
@ -301,8 +305,8 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TableInclusionChecker getTableInclusionChecker(InsertValuesAnalysis insertValuesAnalysis) {
|
protected static TableInclusionChecker getTableInclusionChecker(InsertValuesAnalysis insertValuesAnalysis) {
|
||||||
return (tableMapping) -> !tableMapping.isOptional() || insertValuesAnalysis.hasNonNullBindings( tableMapping );
|
return tableMapping -> !tableMapping.isOptional() || insertValuesAnalysis.hasNonNullBindings( tableMapping );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,7 +323,7 @@ public class InsertCoordinator extends AbstractMutationCoordinator {
|
||||||
return notNull;
|
return notNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
private MutationOperationGroup generateDynamicInsertSqlGroup(boolean[] insertable) {
|
protected MutationOperationGroup generateDynamicInsertSqlGroup(boolean[] insertable) {
|
||||||
assert entityPersister().getEntityMetamodel().isDynamicInsert();
|
assert entityPersister().getEntityMetamodel().isDynamicInsert();
|
||||||
|
|
||||||
final MutationGroupBuilder insertGroupBuilder = new MutationGroupBuilder( MutationType.INSERT, entityPersister() );
|
final MutationGroupBuilder insertGroupBuilder = new MutationGroupBuilder( MutationType.INSERT, entityPersister() );
|
||||||
|
|
|
@ -101,6 +101,14 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
return staticUpdateGroup;
|
return staticUpdateGroup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected MutationOperationGroup getVersionUpdateGroup() {
|
||||||
|
return versionUpdateGroup;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BatchKey getBatchKey() {
|
||||||
|
return batchKey;
|
||||||
|
}
|
||||||
|
|
||||||
public final boolean isModifiableEntity(EntityEntry entry) {
|
public final boolean isModifiableEntity(EntityEntry entry) {
|
||||||
return ( entry == null ? entityPersister().isMutable() : entry.isModifiableEntity() );
|
return ( entry == null ? entityPersister().isMutable() : entry.isModifiableEntity() );
|
||||||
}
|
}
|
||||||
|
@ -361,7 +369,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
: entityPersister().getPropertyUpdateability();
|
: entityPersister().getPropertyUpdateability();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doVersionUpdate(
|
protected void doVersionUpdate(
|
||||||
Object entity,
|
Object entity,
|
||||||
Object id,
|
Object id,
|
||||||
Object version,
|
Object version,
|
||||||
|
@ -612,7 +620,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doStaticUpdate(
|
protected void doStaticUpdate(
|
||||||
Object entity,
|
Object entity,
|
||||||
Object id,
|
Object id,
|
||||||
Object rowId,
|
Object rowId,
|
||||||
|
@ -663,7 +671,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void decomposeForUpdate(
|
protected void decomposeForUpdate(
|
||||||
Object id,
|
Object id,
|
||||||
Object rowId,
|
Object rowId,
|
||||||
Object[] values,
|
Object[] values,
|
||||||
|
@ -789,7 +797,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDynamicUpdate(
|
protected void doDynamicUpdate(
|
||||||
Object entity,
|
Object entity,
|
||||||
Object id,
|
Object id,
|
||||||
Object rowId,
|
Object rowId,
|
||||||
|
@ -866,7 +874,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MutationOperationGroup generateDynamicUpdateGroup(
|
protected MutationOperationGroup generateDynamicUpdateGroup(
|
||||||
Object id,
|
Object id,
|
||||||
Object rowId,
|
Object rowId,
|
||||||
Object[] oldValues,
|
Object[] oldValues,
|
||||||
|
@ -1041,7 +1049,7 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
* what SQL UPDATE statement(s) should be used to update the entity
|
* what SQL UPDATE statement(s) should be used to update the entity
|
||||||
* and to drive parameter binding
|
* and to drive parameter binding
|
||||||
*/
|
*/
|
||||||
private class UpdateValuesAnalysisImpl implements UpdateValuesAnalysis {
|
protected class UpdateValuesAnalysisImpl implements UpdateValuesAnalysis {
|
||||||
private final Object[] values;
|
private final Object[] values;
|
||||||
private final int[] dirtyAttributeIndexes;
|
private final int[] dirtyAttributeIndexes;
|
||||||
private final InclusionChecker dirtinessChecker;
|
private final InclusionChecker dirtinessChecker;
|
||||||
|
@ -1451,12 +1459,12 @@ public class UpdateCoordinatorStandard extends AbstractMutationCoordinator imple
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
private interface InclusionChecker {
|
protected interface InclusionChecker {
|
||||||
boolean include(int position, SingularAttributeMapping attribute);
|
boolean include(int position, SingularAttributeMapping attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
private interface DirtinessChecker {
|
protected interface DirtinessChecker {
|
||||||
boolean isDirty(int position, AttributeMapping attribute);
|
boolean isDirty(int position, AttributeMapping attribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -343,6 +343,10 @@ public class NativeQueryImpl<R>
|
||||||
this.resultMappingSuppliedToCtor = true;
|
this.resultMappingSuppliedToCtor = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ParameterOccurrence> getParameterOccurrences() {
|
||||||
|
return parameterOccurrences;
|
||||||
|
}
|
||||||
|
|
||||||
private ParameterInterpretation resolveParameterInterpretation(
|
private ParameterInterpretation resolveParameterInterpretation(
|
||||||
String sqlString,
|
String sqlString,
|
||||||
SharedSessionContractImplementor session) {
|
SharedSessionContractImplementor session) {
|
||||||
|
@ -614,7 +618,7 @@ public class NativeQueryImpl<R>
|
||||||
return resolveSelectQueryPlan().performList( this );
|
return resolveSelectQueryPlan().performList( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
private SelectQueryPlan<R> resolveSelectQueryPlan() {
|
protected SelectQueryPlan<R> resolveSelectQueryPlan() {
|
||||||
if ( isCacheableQuery() ) {
|
if ( isCacheableQuery() ) {
|
||||||
final QueryInterpretationCache.Key cacheKey = generateSelectInterpretationsKey( resultSetMapping );
|
final QueryInterpretationCache.Key cacheKey = generateSelectInterpretationsKey( resultSetMapping );
|
||||||
return getSession().getFactory().getQueryEngine().getInterpretationCache()
|
return getSession().getFactory().getQueryEngine().getInterpretationCache()
|
||||||
|
@ -659,7 +663,7 @@ public class NativeQueryImpl<R>
|
||||||
.createQueryPlan( queryDefinition, getSessionFactory() );
|
.createQueryPlan( queryDefinition, getSessionFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private String expandParameterLists() {
|
protected String expandParameterLists() {
|
||||||
if ( parameterOccurrences == null || parameterOccurrences.isEmpty() ) {
|
if ( parameterOccurrences == null || parameterOccurrences.isEmpty() ) {
|
||||||
return sqlString;
|
return sqlString;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class SimpleDeleteQueryPlan implements NonSelectQueryPlan {
|
||||||
this.domainParameterXref = domainParameterXref;
|
this.domainParameterXref = domainParameterXref;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SqlAstTranslator<JdbcOperationQueryDelete> createDeleteTranslator(DomainQueryExecutionContext executionContext) {
|
protected SqlAstTranslator<JdbcOperationQueryDelete> createDeleteTranslator(DomainQueryExecutionContext executionContext) {
|
||||||
final SessionFactoryImplementor factory = executionContext.getSession().getFactory();
|
final SessionFactoryImplementor factory = executionContext.getSession().getFactory();
|
||||||
final QueryEngine queryEngine = factory.getQueryEngine();
|
final QueryEngine queryEngine = factory.getQueryEngine();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue