Skip to content

Commit cf3a88a

Browse files
committed
some cleanups related to EntityPersister and CollectionPersister
completely delete obsolete method getManyToManyFilterFragment()
1 parent 5d2bedc commit cf3a88a

File tree

11 files changed

+20
-62
lines changed

11 files changed

+20
-62
lines changed

hibernate-core/src/main/java/org/hibernate/cache/spi/entry/StandardCacheEntryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public Object[] assemble(
149149

150150
}
151151

152-
persister.setPropertyValues( instance, state );
152+
persister.setValues( instance, state );
153153

154154
return state;
155155
}

hibernate-core/src/main/java/org/hibernate/event/internal/DefaultFlushEntityEventListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public void onFlushEntity(FlushEntityEvent event) throws HibernateException {
142142
// now update the object
143143
// has to be outside the main if block above (because of collections)
144144
if ( substitute ) {
145-
persister.setPropertyValues( entity, values );
145+
persister.setValues( entity, values );
146146
}
147147
// Search for collections by reachability, updating their role.
148148
// We don't want to touch collections reachable from a deleted object

hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,25 +1276,6 @@ public void applyBaseManyToManyRestrictions(
12761276
}
12771277
}
12781278

1279-
@Override
1280-
public String getManyToManyFilterFragment(TableGroup tableGroup, Map<String, Filter> enabledFilters) {
1281-
final var fragment = new StringBuilder();
1282-
if ( manyToManyFilterHelper != null ) {
1283-
manyToManyFilterHelper.render( fragment,
1284-
elementPersister.getFilterAliasGenerator( tableGroup ), enabledFilters );
1285-
}
1286-
if ( manyToManyWhereString != null ) {
1287-
if ( !fragment.isEmpty() ) {
1288-
fragment.append( " and " );
1289-
}
1290-
assert elementPersister != null;
1291-
fragment.append( replace( manyToManyWhereTemplate, Template.TEMPLATE,
1292-
tableGroup.resolveTableReference( elementPersister.getTableName() )
1293-
.getIdentificationVariable() ) );
1294-
}
1295-
return fragment.toString();
1296-
}
1297-
12981279
@Override
12991280
public EntityPersister getElementPersister() {
13001281
if ( elementPersister == null ) {

hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ default boolean needsRemove() {
162162
*/
163163
boolean isManyToMany();
164164

165-
String getManyToManyFilterFragment(TableGroup tableGroup, Map<String, Filter> enabledFilters);
166-
167165
/**
168166
* Is this an "indexed" collection? (list or map)
169167
*/

hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,15 @@ public abstract class AbstractEntityPersister
310310

311311
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( AbstractEntityPersister.class );
312312

313+
/**
314+
* The property name of the "special" identifier property in HQL
315+
*
316+
* @deprecated this feature of HQL is now deprecated
317+
*/
318+
@Deprecated(since = "6.2")
319+
public static final String ENTITY_ID = "id";
313320
public static final String ENTITY_CLASS = "class";
321+
314322
public static final String VERSION_COLUMN_ALIAS = "version_";
315323
public static final String ROWID_ALIAS = "rowid_";
316324

@@ -4082,11 +4090,6 @@ public CascadeStyle[] getPropertyCascadeStyles() {
40824090
return getCascadeStyles();
40834091
}
40844092

4085-
@Override
4086-
public boolean isPropertySelectable(int propertyNumber) {
4087-
return getAttributeMapping( propertyNumber ).getAttributeMetadata().isSelectable();
4088-
}
4089-
40904093
@Override
40914094
public final Class<?> getMappedClass() {
40924095
return this.getMappedJavaType().getJavaTypeClass();

hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,10 @@ default MultiNaturalIdLoader<?> getMultiNaturalIdLoader() {
627627

628628
/**
629629
* Load the id for the entity based on the natural id.
630+
*
631+
* @deprecated No longer used
630632
*/
633+
@Deprecated(since = "7.2")
631634
Object loadEntityIdByNaturalId(
632635
Object[] naturalIdValues,
633636
LockOptions lockOptions,
@@ -638,17 +641,6 @@ Object loadEntityIdByNaturalId(
638641
*/
639642
Object load(Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session);
640643

641-
/**
642-
* @deprecated Use {@link #load(Object, Object, LockMode, SharedSessionContractImplementor)}
643-
*/
644-
@Deprecated(since = "6.0")
645-
default Object load(
646-
Object id, Object optionalObject, LockMode lockMode, SharedSessionContractImplementor session,
647-
@SuppressWarnings("unused") Boolean readOnly)
648-
throws HibernateException {
649-
return load( id, optionalObject, lockMode, session );
650-
}
651-
652644
/**
653645
* Load an instance of the persistent class.
654646
*/
@@ -898,10 +890,6 @@ default UpdateCoordinator getMergeCoordinator() {
898890
*/
899891
CascadeStyle[] getPropertyCascadeStyles();
900892

901-
default boolean isPropertySelectable(int propertyNumber) {
902-
return true;
903-
}
904-
905893
/**
906894
* Get the identifier type
907895
*/
@@ -1378,14 +1366,6 @@ default int[] resolveDirtyAttributeIndexes(
13781366

13791367
boolean hasFilterForLoadByKey();
13801368

1381-
/**
1382-
* The property name of the "special" identifier property in HQL
1383-
*
1384-
* @deprecated this feature of HQL is now deprecated
1385-
*/
1386-
@Deprecated(since = "6.2")
1387-
String ENTITY_ID = "id";
1388-
13891369
/**
13901370
* @return Metadata for each unique key defined
13911371
*/

hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPropertyMapping.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ protected void initIdentifierPropertyPaths(
332332

333333
if ( etype.isReferenceToPrimaryKey() ) {
334334
if ( !hasNonIdentifierPropertyNamedId ) {
335-
String idpath1 = extendPath( path, EntityPersister.ENTITY_ID );
336-
addPropertyPath( idpath1, idtype, columns, columnReaders, columnReaderTemplates, factory );
337-
initPropertyPaths( idpath1, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
335+
String idpath = extendPath( path, AbstractEntityPersister.ENTITY_ID );
336+
addPropertyPath( idpath, idtype, columns, columnReaders, columnReaderTemplates, factory );
337+
initPropertyPaths( idpath, idtype, columns, columnReaders, columnReaderTemplates, formulaTemplates, factory );
338338
}
339339
}
340340

@@ -352,7 +352,7 @@ private boolean hasNonIdentifierPropertyNamedId(final EntityType entityType, fin
352352
try {
353353
return factory.getReferencedPropertyType(
354354
entityType.getAssociatedEntityName(),
355-
EntityPersister.ENTITY_ID
355+
AbstractEntityPersister.ENTITY_ID
356356
) != null;
357357
}
358358
catch (MappingException e) {

hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/InsertCoordinatorStandard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ protected boolean preInsertInMemoryValueGeneration(Object[] values, Object entit
140140
&& generator.generatesOnInsert()
141141
&& generator.generatedBeforeExecution( entity, session ) ) {
142142
values[i] = ( (BeforeExecutionGenerator) generator ).generate( session, entity, values[i], INSERT );
143-
persister.setPropertyValue( entity, i, values[i] );
143+
persister.setValue( entity, i, values[i] );
144144
foundStateDependentGenerator = foundStateDependentGenerator || generator.generatedOnExecution();
145145
}
146146
}

hibernate-core/src/main/java/org/hibernate/persister/entity/mutation/UpdateCoordinatorStandard.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ private int[] preUpdateInMemoryValueGeneration(
557557
&& generator.generatesOnUpdate()
558558
&& generator.generatedBeforeExecution( object, session ) ) {
559559
newValues[i] = ( (BeforeExecutionGenerator) generator ).generate( session, object, newValues[i], UPDATE );
560-
entityPersister().setPropertyValue( object, i, newValues[i] );
560+
entityPersister().setValue( object, i, newValues[i] );
561561
fieldsPreUpdateNeeded[count++] = i;
562562
}
563563
}

hibernate-core/src/main/java/org/hibernate/sql/results/graph/entity/internal/EntityInitializerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,7 +1366,7 @@ protected void initializeEntityInstance(EntityInitializerData data) {
13661366
.injectInterceptor( entityInstanceForNotify, entityIdentifier, session );
13671367
}
13681368
}
1369-
data.concreteDescriptor.setPropertyValues( entityInstanceForNotify, resolvedEntityState );
1369+
data.concreteDescriptor.setValues( entityInstanceForNotify, resolvedEntityState );
13701370

13711371
persistenceContext.addEntity( entityKey, entityInstanceForNotify );
13721372

0 commit comments

Comments
 (0)