HHH-17876 Changes for Hibernate Reactive 2.3

Change the scope of some methods and add some getters, so that
subclasses in Hibernate Reactive can reuse some of the existing code.
This commit is contained in:
Davide D'Alto 2024-03-22 10:33:43 +01:00 committed by Christian Beikov
parent 3cf9999ccf
commit 1aa701d435
9 changed files with 52 additions and 13 deletions

View File

@ -50,7 +50,7 @@ public class SqlAstTranslatorWithUpsert<T extends JdbcOperation> extends Abstrac
);
}
private void renderUpsertStatement(OptionalTableUpdate optionalTableUpdate) {
protected void renderUpsertStatement(OptionalTableUpdate optionalTableUpdate) {
// template:
//
// merge into [table] as t

View File

@ -211,4 +211,8 @@ public class GeneratedValuesProcessor {
public EntityMappingType getEntityDescriptor() {
return entityDescriptor;
}
public JdbcOperationQuerySelect getJdbcSelect() {
return jdbcSelect;
}
}

View File

@ -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
);

View File

@ -2048,7 +2048,7 @@ public abstract class AbstractEntityPersister
return select.addRestriction( rootTableKeyColumnNames ).toStatementString();
}
private GeneratedValuesProcessor createGeneratedValuesProcessor(
protected GeneratedValuesProcessor createGeneratedValuesProcessor(
EventType timing,
List<AttributeMapping> 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 ) ) {

View File

@ -117,7 +117,7 @@ public abstract class AbstractMutationCoordinator {
}
}
void handleValueGeneration(
protected void handleValueGeneration(
AttributeMapping attributeMapping,
MutationGroupBuilder mutationGroupBuilder,
OnExecutionGenerator generator) {

View File

@ -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() );

View File

@ -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;

View File

@ -264,6 +264,10 @@ public class EntityDelayedFetchInitializer implements EntityInitializer {
this.processed = processed;
}
protected boolean isProcessed() {
return processed;
}
protected Object getIdentifier() {
return identifier;
}

View File

@ -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
*/
}