HHH-18410 Make use of getter/setter cache as much as possible

This commit is contained in:
Christian Beikov 2024-07-23 20:33:29 +02:00
parent cca52f8ccc
commit 84e57ef368
3 changed files with 6 additions and 17 deletions

View File

@ -182,14 +182,14 @@ public abstract class AbstractEntityInsertAction extends EntityAction {
if ( attribute.isPluralAttributeMapping() ) { if ( attribute.isPluralAttributeMapping() ) {
addCollectionKey( addCollectionKey(
attribute.asPluralAttributeMapping(), attribute.asPluralAttributeMapping(),
descriptor.getValue( object, i ), attribute.getValue( object ),
persistenceContext persistenceContext
); );
} }
else if ( attribute.isEmbeddedAttributeMapping() ) { else if ( attribute.isEmbeddedAttributeMapping() ) {
visitEmbeddedAttributeMapping( visitEmbeddedAttributeMapping(
attribute.asEmbeddedAttributeMapping(), attribute.asEmbeddedAttributeMapping(),
descriptor.getValue( object, i ), attribute.getValue( object ),
persistenceContext persistenceContext
); );
} }

View File

@ -412,7 +412,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
} }
@Override @Override
public @Nullable EntityHolderImpl getEntityHolder(EntityKey key) { public EntityHolderImpl getEntityHolder(EntityKey key) {
return entitiesByKey == null ? null : entitiesByKey.get( key ); return entitiesByKey == null ? null : entitiesByKey.get( key );
} }
@ -525,7 +525,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
} }
@Override @Override
public @Nullable EntityHolderImpl removeEntityHolder(EntityKey key) { public EntityHolderImpl removeEntityHolder(EntityKey key) {
final EntityHolderImpl holder; final EntityHolderImpl holder;
if ( entitiesByKey != null ) { if ( entitiesByKey != null ) {
holder = entitiesByKey.remove( key ); holder = entitiesByKey.remove( key );
@ -1316,7 +1316,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
*/ */
@Override @Override
@Deprecated @Deprecated
public @Nullable Map<PersistentCollection<?>,CollectionEntry> getCollectionEntries() { public Map<PersistentCollection<?>,CollectionEntry> getCollectionEntries() {
return collectionEntries; return collectionEntries;
} }

View File

@ -398,18 +398,7 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen
return ((Object[]) component)[i]; return ((Object[]) component)[i];
} }
else { else {
final EmbeddableMappingType embeddableMappingType = embeddableTypeDescriptor(); return embeddableTypeDescriptor().getValue( component, i );
if ( embeddableMappingType.isPolymorphic() ) {
final EmbeddableMappingType.ConcreteEmbeddableType concreteEmbeddableType = embeddableMappingType.findSubtypeBySubclass(
component.getClass().getName()
);
return concreteEmbeddableType.declaresAttribute( i )
? embeddableMappingType.getValue( component, i )
: null;
}
else {
return embeddableMappingType.getValue( component, i );
}
} }
} }