HHH-18610 DynamicFetchBuilderLegacy LockMode

This commit is contained in:
Andrea Boriero 2024-11-13 11:45:24 +01:00
parent b565d2b3af
commit bfaf3c5931
1 changed files with 8 additions and 0 deletions

View File

@ -61,6 +61,8 @@ public class DynamicFetchBuilderLegacy
private final Map<Fetchable, FetchBuilder> fetchBuilderMap;
private final DynamicResultBuilderEntityStandard resultBuilderEntity;
private LockMode lockMode;
public DynamicFetchBuilderLegacy(
String tableAlias,
String ownerTableAlias,
@ -107,6 +109,7 @@ public class DynamicFetchBuilderLegacy
@Override
public NativeQuery.FetchReturn setLockMode(LockMode lockMode) {
this.lockMode = lockMode;
return this;
}
@ -176,6 +179,9 @@ public class DynamicFetchBuilderLegacy
final DomainResultCreationStateImpl creationState = impl( domainResultCreationState );
final TableGroup ownerTableGroup = creationState.getFromClauseAccess().findByAlias( ownerTableAlias );
final TableGroup tableGroup;
if ( lockMode != null ) {
domainResultCreationState.getSqlAstCreationState().registerLockMode( tableAlias, lockMode );
}
if ( fetchable instanceof TableGroupJoinProducer ) {
final SqlAliasBase sqlAliasBase = new SqlAliasBaseConstant( tableAlias );
final TableGroupJoin tableGroupJoin = ( (TableGroupJoinProducer) fetchable ).createTableGroupJoin(
@ -359,6 +365,7 @@ public class DynamicFetchBuilderLegacy
return tableAlias.equals( that.tableAlias )
&& ownerTableAlias.equals( that.ownerTableAlias )
&& fetchable.equals( that.fetchable )
&& lockMode.equals( that.lockMode )
&& Objects.equals( columnNames, that.columnNames )
&& Objects.equals( fetchBuilderMap, that.fetchBuilderMap )
&& Objects.equals( resultBuilderEntity, that.resultBuilderEntity );
@ -369,6 +376,7 @@ public class DynamicFetchBuilderLegacy
int result = tableAlias.hashCode();
result = 31 * result + ownerTableAlias.hashCode();
result = 31 * result + fetchable.hashCode();
result = 31 * result + lockMode.hashCode();
result = 31 * result + ( columnNames != null ? columnNames.hashCode() : 0 );
result = 31 * result + ( fetchBuilderMap != null ? fetchBuilderMap.hashCode() : 0 );
result = 31 * result + ( resultBuilderEntity != null ? resultBuilderEntity.hashCode() : 0 );