diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/SqlAstTranslatorWithUpsert.java b/hibernate-core/src/main/java/org/hibernate/dialect/SqlAstTranslatorWithUpsert.java index 50988e8adc..a048d92590 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/SqlAstTranslatorWithUpsert.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/SqlAstTranslatorWithUpsert.java @@ -50,7 +50,7 @@ public class SqlAstTranslatorWithUpsert extends Abstrac ); } - private void renderUpsertStatement(OptionalTableUpdate optionalTableUpdate) { + protected void renderUpsertStatement(OptionalTableUpdate optionalTableUpdate) { // template: // // merge into [table] as t diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/GeneratedValuesProcessor.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/GeneratedValuesProcessor.java index e7712b6299..97e48348b6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/GeneratedValuesProcessor.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/GeneratedValuesProcessor.java @@ -211,4 +211,8 @@ public class GeneratedValuesProcessor { public EntityMappingType getEntityDescriptor() { return entityDescriptor; } + + public JdbcOperationQuerySelect getJdbcSelect() { + return jdbcSelect; + } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java index d8aebd011f..298819e3d8 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java @@ -506,6 +506,7 @@ public class PluralAttributeMappingImpl fetchablePath, this, collectionTableGroup, + referencedPropertyName != null, fetchParent, creationState ); @@ -570,13 +571,14 @@ public class PluralAttributeMappingImpl NavigablePath fetchedPath, PluralAttributeMapping fetchedAttribute, TableGroup collectionTableGroup, + boolean needsCollectionKeyResult, FetchParent fetchParent, DomainResultCreationState creationState) { return new EagerCollectionFetch( fetchedPath, fetchedAttribute, collectionTableGroup, - referencedPropertyName != null, + needsCollectionKeyResult, fetchParent, creationState ); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 60bbeeb740..3adde0a9f7 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -2048,7 +2048,7 @@ public abstract class AbstractEntityPersister return select.addRestriction( rootTableKeyColumnNames ).toStatementString(); } - private GeneratedValuesProcessor createGeneratedValuesProcessor( + protected GeneratedValuesProcessor createGeneratedValuesProcessor( EventType timing, List generatedAttributes) { return new GeneratedValuesProcessor( this, generatedAttributes, timing, getFactory() ); @@ -3433,16 +3433,12 @@ public abstract class AbstractEntityPersister insertGeneratedProperties = initInsertGeneratedProperties( insertGeneratedAttributes ); updateGeneratedProperties = initUpdateGeneratedProperties( updateGeneratedAttributes ); + insertDelegate = createInsertDelegate(); + updateDelegate = createUpdateDelegate(); + if ( isIdentifierAssignedByInsert() ) { - final OnExecutionGenerator generator = (OnExecutionGenerator) getGenerator(); - insertDelegate = generator.getGeneratedIdentifierDelegate( this ); identitySelectString = getIdentitySelectString( factory.getJdbcServices().getDialect() ); } - else { - insertDelegate = GeneratedValuesHelper.getGeneratedValuesDelegate( this, INSERT ); - } - - updateDelegate = GeneratedValuesHelper.getGeneratedValuesDelegate( this, UPDATE ); if ( hasInsertGeneratedProperties() ) { insertGeneratedValuesProcessor = createGeneratedValuesProcessor( INSERT, insertGeneratedAttributes ); @@ -3469,6 +3465,18 @@ public abstract class AbstractEntityPersister sqlVersionSelectString = generateSelectVersionString(); } + protected GeneratedValuesMutationDelegate createInsertDelegate() { + if ( isIdentifierAssignedByInsert() ) { + final OnExecutionGenerator generator = (OnExecutionGenerator) getGenerator(); + return generator.getGeneratedIdentifierDelegate( this ); + } + return GeneratedValuesHelper.getGeneratedValuesDelegate( this, INSERT ); + } + + protected GeneratedValuesMutationDelegate createUpdateDelegate() { + return GeneratedValuesHelper.getGeneratedValuesDelegate( this, UPDATE ); + } + private EntityTableMapping findTableMapping(String tableName) { for ( int i = 0; i < tableMappings.length; i++ ) { if ( tableMappings[i].getTableName().equals( tableName ) ) { diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/AbstractMutationCoordinator.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/AbstractMutationCoordinator.java index faff64b750..971697403c 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/AbstractMutationCoordinator.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/AbstractMutationCoordinator.java @@ -117,7 +117,7 @@ public abstract class AbstractMutationCoordinator { } } - void handleValueGeneration( + protected void handleValueGeneration( AttributeMapping attributeMapping, MutationGroupBuilder mutationGroupBuilder, OnExecutionGenerator generator) { diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/AbstractCteMutationHandler.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/AbstractCteMutationHandler.java index 235d9789ac..3c4e201811 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/AbstractCteMutationHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/mutation/internal/cte/AbstractCteMutationHandler.java @@ -212,7 +212,10 @@ public abstract class AbstractCteMutationHandler extends AbstractMutationHandler return ( (Number) list.get( 0 ) ).intValue(); } - private Expression createCountStar( + /** + * Used by Hibernate Raective + */ + protected Expression createCountStar( SessionFactoryImplementor factory, MultiTableSqmMutationConverter sqmConverter) { final SqmExpression arg = new SqmStar( factory.getNodeBuilder() ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java index 5d36f497af..0ff7ed8b66 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/AbstractEntityInitializer.java @@ -113,7 +113,7 @@ public abstract class AbstractEntityInitializer extends AbstractFetchParentAcces private EntityKey entityKey; private Object version; private Object entityInstance; - private Object entityInstanceForNotify; + protected Object entityInstanceForNotify; protected State state = State.UNINITIALIZED; private boolean isOwningInitializer; private Object[] resolvedEntityState; diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java index b5b912fdc3..799d78a32f 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityDelayedFetchInitializer.java @@ -264,6 +264,10 @@ public class EntityDelayedFetchInitializer implements EntityInitializer { this.processed = processed; } + protected boolean isProcessed() { + return processed; + } + protected Object getIdentifier() { return identifier; } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityFetchJoinedImpl.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityFetchJoinedImpl.java index c821c94c2a..8031aa9ec2 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityFetchJoinedImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityFetchJoinedImpl.java @@ -197,4 +197,22 @@ public class EntityFetchJoinedImpl extends AbstractFetchParent implements Entity public void collectValueIndexesToCache(BitSet valueIndexes) { entityResult.collectValueIndexesToCache( valueIndexes ); } + + /* + * BEGIN: For Hibernate Reactive + */ + protected DomainResult getKeyResult() { + return keyResult; + } + + protected NotFoundAction getNotFoundAction() { + return notFoundAction; + } + + protected String getSourceAlias() { + return sourceAlias; + } + /* + * END: Hibernate Reactive: make sure values are accessible from subclass + */ }