From 87638a9a2e6281fed04e0f33dbc4c9b355f281dd Mon Sep 17 00:00:00 2001 From: Christian Beikov Date: Fri, 11 Feb 2022 10:22:24 +0100 Subject: [PATCH] Get rid of most walking stuff --- .../mapping}/internal/FetchOptionsHelper.java | 42 +-- .../internal/MappingModelCreationHelper.java | 1 - .../AbstractCollectionPersister.java | 189 ----------- .../collection/CollectionPersister.java | 3 +- .../entity/AbstractEntityPersister.java | 182 ----------- .../persister/entity/EntityPersister.java | 15 +- ...ompositionSingularSubAttributesHelper.java | 298 ------------------ .../EntityIdentifierDefinitionHelper.java | 183 ----------- .../internal/StandardAnyTypeDefinition.java | 86 ----- .../walking/spi/AnyMappingDefinition.java | 87 ----- .../spi/AssociationAttributeDefinition.java | 44 --- .../persister/walking/spi/AssociationKey.java | 69 ---- .../walking/spi/AttributeDefinition.java | 20 -- .../walking/spi/AttributeSource.java | 1 - .../walking/spi/CollectionDefinition.java | 21 -- .../spi/CollectionElementDefinition.java | 71 ----- .../spi/CollectionIndexDefinition.java | 65 ---- .../CompositeCollectionElementDefinition.java | 20 -- .../walking/spi/CompositionDefinition.java | 17 - ...ncapsulatedEntityIdentifierDefinition.java | 14 - .../walking/spi/EntityDefinition.java | 19 -- .../spi/EntityIdentifierDefinition.java | 26 -- ...ncapsulatedEntityIdentifierDefinition.java | 19 -- .../walking/spi/WalkingException.java | 24 -- .../tuple/AbstractNonIdentifierAttribute.java | 1 - .../tuple/NonIdentifierAttribute.java | 3 +- .../org/hibernate/tuple/PropertyFactory.java | 36 --- .../AbstractCompositionAttribute.java | 171 +--------- .../CompositeBasedAssociationAttribute.java | 194 ------------ .../CompositeBasedBasicAttribute.java | 28 -- .../CompositionBasedCompositionAttribute.java | 49 --- .../EntityBasedAssociationAttribute.java | 173 +--------- .../EntityBasedCompositionAttribute.java | 4 +- .../GoofyPersisterClassProvider.java | 34 -- .../BatchFetchStrategyHelperTest.java | 2 +- .../FetchStrategyHelperTest.java | 2 +- .../NoProxyFetchStrategyHelperTest.java | 2 +- .../PersisterClassProviderTest.java | 16 - .../orm/test/legacy/CustomPersister.java | 16 - 39 files changed, 12 insertions(+), 2235 deletions(-) rename hibernate-core/src/main/java/org/hibernate/{persister/walking => metamodel/mapping}/internal/FetchOptionsHelper.java (69%) delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/internal/CompositionSingularSubAttributesHelper.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/internal/EntityIdentifierDefinitionHelper.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/internal/StandardAnyTypeDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AnyMappingDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationAttributeDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationKey.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionElementDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionIndexDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositeCollectionElementDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositionDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EncapsulatedEntityIdentifierDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityIdentifierDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/NonEncapsulatedEntityIdentifierDefinition.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/persister/walking/spi/WalkingException.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedAssociationAttribute.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedBasicAttribute.java delete mode 100644 hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/FetchOptionsHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/FetchOptionsHelper.java similarity index 69% rename from hibernate-core/src/main/java/org/hibernate/persister/walking/internal/FetchOptionsHelper.java rename to hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/FetchOptionsHelper.java index 9544800ce7..f057fd7dd2 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/FetchOptionsHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/FetchOptionsHelper.java @@ -4,20 +4,15 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ -package org.hibernate.persister.walking.internal; +package org.hibernate.metamodel.mapping.internal; import org.hibernate.FetchMode; import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchTiming; -import org.hibernate.engine.profile.Fetch; -import org.hibernate.engine.profile.FetchProfile; -import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.loader.PropertyPath; import org.hibernate.persister.collection.AbstractCollectionPersister; import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.entity.OuterJoinLoadable; import org.hibernate.sql.results.graph.FetchOptions; import org.hibernate.type.AssociationType; @@ -28,41 +23,6 @@ public final class FetchOptionsHelper { private FetchOptionsHelper() { } - /** - * Determine the fetch-style (if one) explicitly set for this association via fetch profiles. - *

- * Note that currently fetch profiles only allow specifying join fetching, so this method currently - * returns either (a) FetchStyle.JOIN or (b) null - */ - public static FetchStyle determineFetchStyleByProfile( - LoadQueryInfluencers loadQueryInfluencers, - EntityPersister persister, - PropertyPath path, - int propertyNumber) { - if ( !loadQueryInfluencers.hasEnabledFetchProfiles() ) { - // perf optimization - return null; - } - - // ugh, this stuff has to be made easier... - final String fullPath = path.getFullPath(); - final String rootPropertyName = ( (OuterJoinLoadable) persister ).getSubclassPropertyName( propertyNumber ); - int pos = fullPath.lastIndexOf( rootPropertyName ); - final String relativePropertyPath = pos >= 0 - ? fullPath.substring( pos ) - : rootPropertyName; - final String fetchRole = persister.getEntityName() + '.' + relativePropertyPath; - - for ( String profileName : loadQueryInfluencers.getEnabledFetchProfileNames() ) { - final FetchProfile profile = loadQueryInfluencers.getSessionFactory().getFetchProfile( profileName ); - final Fetch fetch = profile.getFetchByRole( fetchRole ); - if ( fetch != null && Fetch.Style.JOIN == fetch.getStyle() ) { - return FetchStyle.JOIN; - } - } - return null; - } - /** * * @param mappingFetchMode The mapping defined fetch mode diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java index fa74063e7b..7c42e91526 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java @@ -78,7 +78,6 @@ import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.collection.SQLLoadableCollection; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.Joinable; -import org.hibernate.persister.walking.internal.FetchOptionsHelper; import org.hibernate.property.access.internal.ChainedPropertyAccessImpl; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.sql.ast.spi.SqlAliasStemHelper; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java index 36cb8df645..ab3aa5e39f 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java @@ -88,17 +88,6 @@ import org.hibernate.persister.entity.Joinable; import org.hibernate.persister.entity.PropertyMapping; import org.hibernate.persister.internal.SqlFragmentPredicate; import org.hibernate.persister.spi.PersisterCreationContext; -import org.hibernate.persister.walking.internal.CompositionSingularSubAttributesHelper; -import org.hibernate.persister.walking.internal.StandardAnyTypeDefinition; -import org.hibernate.persister.walking.spi.AnyMappingDefinition; -import org.hibernate.persister.walking.spi.AttributeDefinition; -import org.hibernate.persister.walking.spi.AttributeSource; -import org.hibernate.persister.walking.spi.CollectionDefinition; -import org.hibernate.persister.walking.spi.CollectionElementDefinition; -import org.hibernate.persister.walking.spi.CollectionIndexDefinition; -import org.hibernate.persister.walking.spi.CompositeCollectionElementDefinition; -import org.hibernate.persister.walking.spi.CompositionDefinition; -import org.hibernate.persister.walking.spi.EntityDefinition; import org.hibernate.pretty.MessageHelper; import org.hibernate.query.spi.NavigablePath; import org.hibernate.query.named.NamedQueryMemento; @@ -123,8 +112,6 @@ import org.hibernate.sql.ast.tree.select.SelectClause; import org.hibernate.sql.ast.tree.select.SelectStatement; import org.hibernate.sql.results.graph.DomainResult; import org.hibernate.sql.results.internal.SqlSelectionImpl; -import org.hibernate.type.AnyType; -import org.hibernate.type.AssociationType; import org.hibernate.type.CollectionType; import org.hibernate.type.CompositeType; import org.hibernate.type.EntityType; @@ -2268,186 +2255,10 @@ public abstract class AbstractCollectionPersister return mappedByProperty; } -// private class StandardOrderByAliasResolver implements OrderByAliasResolver { -// private final String rootAlias; -// -// private StandardOrderByAliasResolver(String rootAlias) { -// this.rootAlias = rootAlias; -// } -// -// @Override -// public String resolveTableAlias(String columnReference) { -// if ( elementPersister == null ) { -// // we have collection of non-entity elements... -// return rootAlias; -// } -// else { -// return ( (Loadable) elementPersister ).getTableAliasForColumn( columnReference, rootAlias ); -// } -// } -// } - public abstract FilterAliasGenerator getFilterAliasGenerator(String rootAlias); public abstract FilterAliasGenerator getFilterAliasGenerator(TableGroup tableGroup); - // ColectionDefinition impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - @Override - public CollectionPersister getCollectionPersister() { - return this; - } - - @Override - public CollectionIndexDefinition getIndexDefinition() { - if ( ! hasIndex() ) { - return null; - } - - return new CollectionIndexDefinition() { - @Override - public CollectionDefinition getCollectionDefinition() { - return AbstractCollectionPersister.this; - } - - @Override - public Type getType() { - return getIndexType(); - } - - @Override - public EntityDefinition toEntityDefinition() { - if ( !getType().isEntityType() ) { - throw new IllegalStateException( "Cannot treat collection index type as entity" ); - } - return (EntityPersister) ( (AssociationType) getIndexType() ).getAssociatedJoinable( getFactory() ); - } - - @Override - public CompositionDefinition toCompositeDefinition() { - if ( ! getType().isComponentType() ) { - throw new IllegalStateException( "Cannot treat collection index type as composite" ); - } - return new CompositeCollectionElementDefinition() { - @Override - public String getName() { - return "index"; - } - - @Override - public CompositeType getType() { - return (CompositeType) getIndexType(); - } - - @Override - public boolean isNullable() { - return false; - } - - @Override - public AttributeSource getSource() { - // TODO: what if this is a collection w/in an encapsulated composition attribute? - // should return the encapsulated composition attribute instead??? - return getOwnerEntityPersister(); - } - - @Override - public Iterable getAttributes() { - return CompositionSingularSubAttributesHelper.getCompositeCollectionIndexSubAttributes( this ); - } - @Override - public CollectionDefinition getCollectionDefinition() { - return AbstractCollectionPersister.this; - } - }; - } - - @Override - public AnyMappingDefinition toAnyMappingDefinition() { - final Type type = getType(); - if ( ! type.isAnyType() ) { - throw new IllegalStateException( "Cannot treat collection index type as ManyToAny" ); - } - return new StandardAnyTypeDefinition( (AnyType) type, isLazy() || isExtraLazy() ); - } - }; - } - - @Override - public CollectionElementDefinition getElementDefinition() { - return new CollectionElementDefinition() { - @Override - public CollectionDefinition getCollectionDefinition() { - return AbstractCollectionPersister.this; - } - - @Override - public Type getType() { - return getElementType(); - } - - @Override - public AnyMappingDefinition toAnyMappingDefinition() { - final Type type = getType(); - if ( ! type.isAnyType() ) { - throw new IllegalStateException( "Cannot treat collection element type as ManyToAny" ); - } - return new StandardAnyTypeDefinition( (AnyType) type, isLazy() || isExtraLazy() ); - } - - @Override - public EntityDefinition toEntityDefinition() { - if ( !getType().isEntityType() ) { - throw new IllegalStateException( "Cannot treat collection element type as entity" ); - } - return getElementPersister(); - } - - @Override - public CompositeCollectionElementDefinition toCompositeElementDefinition() { - - if ( ! getType().isComponentType() ) { - throw new IllegalStateException( "Cannot treat entity collection element type as composite" ); - } - - return new CompositeCollectionElementDefinition() { - @Override - public String getName() { - return ""; - } - - @Override - public CompositeType getType() { - return (CompositeType) getElementType(); - } - - @Override - public boolean isNullable() { - return false; - } - - @Override - public AttributeSource getSource() { - // TODO: what if this is a collection w/in an encapsulated composition attribute? - // should return the encapsulated composition attribute instead??? - return getOwnerEntityPersister(); - } - - @Override - public Iterable getAttributes() { - return CompositionSingularSubAttributesHelper.getCompositeCollectionElementSubAttributes( this ); - } - - @Override - public CollectionDefinition getCollectionDefinition() { - return AbstractCollectionPersister.this; - } - }; - } - }; - } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // "mapping model" diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java index 6fe2169f39..f57b2b7b1e 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/CollectionPersister.java @@ -30,7 +30,6 @@ import org.hibernate.metamodel.mapping.Restrictable; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.walking.spi.CollectionDefinition; import org.hibernate.sql.ast.spi.SqlAstCreationState; import org.hibernate.sql.ast.tree.from.TableGroup; import org.hibernate.sql.ast.tree.predicate.Predicate; @@ -86,7 +85,7 @@ import org.hibernate.type.Type; * * @author Gavin King */ -public interface CollectionPersister extends CollectionDefinition, Restrictable { +public interface CollectionPersister extends Restrictable { NavigableRole getNavigableRole(); /** 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 f3e6977df1..ba6b91b3e2 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 @@ -196,9 +196,6 @@ import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.internal.SqlFragmentPredicate; import org.hibernate.persister.spi.PersisterCreationContext; -import org.hibernate.persister.walking.internal.EntityIdentifierDefinitionHelper; -import org.hibernate.persister.walking.spi.AttributeDefinition; -import org.hibernate.persister.walking.spi.EntityIdentifierDefinition; import org.hibernate.pretty.MessageHelper; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.property.access.spi.Setter; @@ -4056,7 +4053,6 @@ public abstract class AbstractEntityPersister initPropertyPaths( mapping ); //doLateInit(); - prepareEntityIdentifierDefinition(); } private void doLateInit() { @@ -6526,17 +6522,6 @@ public abstract class AbstractEntityPersister // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // EntityDefinition impl (walking model - deprecated) - private EntityIdentifierDefinition entityIdentifierDefinition; - private final SortedSet attributeDefinitions = new TreeSet<>( - Comparator.comparing( AttributeDefinition::getName ) - ); - - @Override - public void generateEntityDefinition() { - prepareEntityIdentifierDefinition(); - collectAttributeDefinitions(); - } - @Override public int getJdbcTypeCount() { return getIdentifierMapping().getJdbcTypeCount(); @@ -6597,173 +6582,6 @@ public abstract class AbstractEntityPersister ); } - @Override - public EntityIdentifierDefinition getEntityKeyDefinition() { - return entityIdentifierDefinition; - } - - @Override - public Iterable getAttributes() { - return attributeDefinitions; - } - - private void prepareEntityIdentifierDefinition() { - if ( entityIdentifierDefinition != null ) { - return; - } - final Type idType = getIdentifierType(); - - if ( !idType.isComponentType() ) { - entityIdentifierDefinition = - EntityIdentifierDefinitionHelper.buildSimpleEncapsulatedIdentifierDefinition( this ); - return; - } - - final CompositeType cidType = (CompositeType) idType; - if ( !cidType.isEmbedded() ) { - entityIdentifierDefinition = - EntityIdentifierDefinitionHelper.buildEncapsulatedCompositeIdentifierDefinition( this ); - return; - } - - entityIdentifierDefinition = - EntityIdentifierDefinitionHelper.buildNonEncapsulatedCompositeIdentifierDefinition( this ); - } - - private void collectAttributeDefinitions( - Map attributeDefinitionsByName, - EntityMetamodel metamodel) { - for ( int i = 0; i < metamodel.getPropertySpan(); i++ ) { - final AttributeDefinition attributeDefinition = metamodel.getProperties()[i]; - // Don't replace an attribute definition if it is already in attributeDefinitionsByName - // because the new value will be from a subclass. - final AttributeDefinition oldAttributeDefinition = attributeDefinitionsByName.get( - attributeDefinition.getName() - ); - if ( oldAttributeDefinition != null ) { - if ( LOG.isTraceEnabled() ) { - LOG.tracef( - "Ignoring subclass attribute definition [%s.%s] because it is defined in a superclass ", - entityMetamodel.getName(), - attributeDefinition.getName() - ); - } - } - else { - attributeDefinitionsByName.put( attributeDefinition.getName(), attributeDefinition ); - } - } - - // see if there are any subclass persisters... - final Set subClassEntityNames = metamodel.getSubclassEntityNames(); - if ( subClassEntityNames == null ) { - return; - } - - // see if we can find the persisters... - for ( String subClassEntityName : subClassEntityNames ) { - if ( metamodel.getName().equals( subClassEntityName ) ) { - // skip it - continue; - } - try { - final EntityPersister subClassEntityPersister = factory.getRuntimeMetamodels() - .getMappingMetamodel() - .getEntityDescriptor( subClassEntityName ); - collectAttributeDefinitions( attributeDefinitionsByName, subClassEntityPersister.getEntityMetamodel() ); - } - catch (MappingException e) { - throw new IllegalStateException( - String.format( - "Could not locate subclass EntityPersister [%s] while processing EntityPersister [%s]", - subClassEntityName, - metamodel.getName() - ), - e - ); - } - } - } - - private void collectAttributeDefinitions() { - // todo : I think this works purely based on luck atm - // specifically in terms of the sub/super class entity persister(s) being available. Bit of chicken-egg - // problem there: - // * If I do this during postConstruct (as it is now), it works as long as the - // super entity persister is already registered, but I don't think that is necessarily true. - // * If I do this during postInstantiate then lots of stuff in postConstruct breaks if we want - // to try and drive SQL generation on these (which we do ultimately). A possible solution there - // would be to delay all SQL generation until postInstantiate - - Map attributeDefinitionsByName = new LinkedHashMap<>(); - collectAttributeDefinitions( attributeDefinitionsByName, getEntityMetamodel() ); - - -// EntityMetamodel currentEntityMetamodel = this.getEntityMetamodel(); -// while ( currentEntityMetamodel != null ) { -// for ( int i = 0; i < currentEntityMetamodel.getPropertySpan(); i++ ) { -// attributeDefinitions.add( currentEntityMetamodel.getProperties()[i] ); -// } -// // see if there is a super class EntityMetamodel -// final String superEntityName = currentEntityMetamodel.getSuperclass(); -// if ( superEntityName != null ) { -// currentEntityMetamodel = factory.getEntityPersister( superEntityName ).getEntityMetamodel(); -// } -// else { -// currentEntityMetamodel = null; -// } -// } - -// // todo : leverage the attribute definitions housed on EntityMetamodel -// // for that to work, we'd have to be able to walk our super entity persister(s) -// this.attributeDefinitions = new Iterable() { -// @Override -// public Iterator iterator() { -// return new Iterator() { -//// private final int numberOfAttributes = countSubclassProperties(); -//// private final int numberOfAttributes = entityMetamodel.getPropertySpan(); -// -// EntityMetamodel currentEntityMetamodel = entityMetamodel; -// int numberOfAttributesInCurrentEntityMetamodel = currentEntityMetamodel.getPropertySpan(); -// -// private int currentAttributeNumber; -// -// @Override -// public boolean hasNext() { -// return currentEntityMetamodel != null -// && currentAttributeNumber < numberOfAttributesInCurrentEntityMetamodel; -// } -// -// @Override -// public AttributeDefinition next() { -// final int attributeNumber = currentAttributeNumber; -// currentAttributeNumber++; -// final AttributeDefinition next = currentEntityMetamodel.getProperties()[ attributeNumber ]; -// -// if ( currentAttributeNumber >= numberOfAttributesInCurrentEntityMetamodel ) { -// // see if there is a super class EntityMetamodel -// final String superEntityName = currentEntityMetamodel.getSuperclass(); -// if ( superEntityName != null ) { -// currentEntityMetamodel = factory.getEntityPersister( superEntityName ).getEntityMetamodel(); -// if ( currentEntityMetamodel != null ) { -// numberOfAttributesInCurrentEntityMetamodel = currentEntityMetamodel.getPropertySpan(); -// currentAttributeNumber = 0; -// } -// } -// } -// -// return next; -// } -// -// @Override -// public void remove() { -// throw new UnsupportedOperationException( "Remove operation not supported here" ); -// } -// }; -// } -// }; - } - protected Insert createInsert() { return new Insert( getFactory().getJdbcServices().getDialect() ); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java index abcf9ef186..dc19f8c440 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/EntityPersister.java @@ -38,7 +38,7 @@ import org.hibernate.metamodel.mapping.AttributeMapping; import org.hibernate.metamodel.mapping.EntityMappingType; import org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType; import org.hibernate.metamodel.spi.EntityRepresentationStrategy; -import org.hibernate.persister.walking.spi.EntityDefinition; +import org.hibernate.persister.walking.spi.AttributeSource; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; import org.hibernate.sql.ast.spi.SqlAliasStemHelper; @@ -99,24 +99,13 @@ import org.hibernate.type.descriptor.java.VersionJavaType; * @see org.hibernate.persister.spi.PersisterClassResolver */ public interface EntityPersister - extends EntityMappingType, Loadable, RootTableGroupProducer, EntityDefinition { + extends EntityMappingType, Loadable, RootTableGroupProducer, AttributeSource { /** * The property name of the "special" identifier property in HQL */ String ENTITY_ID = "id"; - /** - * Generate the entity definition for this object. This must be done for all - * entity persisters before calling {@link #postInstantiate()}. - * - * @deprecated The legacy "walking model" is deprecated in favor of the newer "mapping model". - * This method is no longer called by Hibernate. - * See {@link InFlightEntityMappingType#prepareMappingModel} instead - */ - @Deprecated(since = "6.0") - void generateEntityDefinition(); - /** * Finish the initialization of this object. {@link InFlightEntityMappingType#prepareMappingModel} * must be called for all entity persisters before calling this method. diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/CompositionSingularSubAttributesHelper.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/CompositionSingularSubAttributesHelper.java deleted file mode 100644 index ed11b141a3..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/CompositionSingularSubAttributesHelper.java +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.internal; - -import java.util.Iterator; - -import org.hibernate.FetchMode; -import org.hibernate.engine.FetchStyle; -import org.hibernate.engine.FetchTiming; -import org.hibernate.engine.spi.CascadeStyle; -import org.hibernate.engine.spi.CascadeStyles; -import org.hibernate.engine.spi.LoadQueryInfluencers; -import org.hibernate.internal.util.collections.ArrayHelper; -import org.hibernate.loader.PropertyPath; -import org.hibernate.persister.collection.QueryableCollection; -import org.hibernate.persister.entity.AbstractEntityPersister; -import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.entity.OuterJoinLoadable; -import org.hibernate.persister.spi.HydratedCompoundValueHandler; -import org.hibernate.persister.walking.spi.AnyMappingDefinition; -import org.hibernate.persister.walking.spi.AssociationAttributeDefinition; -import org.hibernate.persister.walking.spi.AssociationKey; -import org.hibernate.persister.walking.spi.AttributeDefinition; -import org.hibernate.persister.walking.spi.AttributeSource; -import org.hibernate.persister.walking.spi.CollectionDefinition; -import org.hibernate.persister.walking.spi.CompositeCollectionElementDefinition; -import org.hibernate.persister.walking.spi.CompositionDefinition; -import org.hibernate.persister.walking.spi.EntityDefinition; -import org.hibernate.persister.walking.spi.WalkingException; -import org.hibernate.sql.results.graph.FetchOptions; -import org.hibernate.type.AnyType; -import org.hibernate.type.AssociationType; -import org.hibernate.type.CompositeType; -import org.hibernate.type.Type; - -/** - * A helper for getting attributes from a composition that is known - * to have only singular attributes; for example, sub-attributes of a - * composite ID or a composite collection element. - * - * TODO: This should be refactored into a delegate and renamed. - * - * @author Gail Badner - */ -public final class CompositionSingularSubAttributesHelper { - private CompositionSingularSubAttributesHelper() { - } - - /** - * Get composite ID sub-attribute definitions. - * - * @param entityPersister - the entity persister. - * - * @return composite ID sub-attribute definitions. - */ - public static Iterable getIdentifierSubAttributes(AbstractEntityPersister entityPersister) { - return getSingularSubAttributes( - entityPersister, - entityPersister, - (CompositeType) entityPersister.getIdentifierType(), - entityPersister.getTableName(), - entityPersister.getRootTableIdentifierColumnNames() - ); - } - - /** - * Get sub-attribute definitions for a composite collection element. - * @param compositionElementDefinition - composite collection element definition. - * @return sub-attribute definitions for a composite collection element. - */ - public static Iterable getCompositeCollectionElementSubAttributes( - CompositeCollectionElementDefinition compositionElementDefinition) { - final QueryableCollection collectionPersister = - (QueryableCollection) compositionElementDefinition.getCollectionDefinition().getCollectionPersister(); - return getSingularSubAttributes( - compositionElementDefinition.getSource(), - (OuterJoinLoadable) collectionPersister.getOwnerEntityPersister(), - (CompositeType) collectionPersister.getElementType(), - collectionPersister.getTableName(), - collectionPersister.getElementColumnNames() - ); - } - - public static Iterable getCompositeCollectionIndexSubAttributes(CompositeCollectionElementDefinition compositionElementDefinition){ - final QueryableCollection collectionPersister = - (QueryableCollection) compositionElementDefinition.getCollectionDefinition().getCollectionPersister(); - return getSingularSubAttributes( - compositionElementDefinition.getSource(), - (OuterJoinLoadable) collectionPersister.getOwnerEntityPersister(), - (CompositeType) collectionPersister.getIndexType(), - collectionPersister.getTableName(), - collectionPersister.toColumns( "index" ) - ); - } - - private static Iterable getSingularSubAttributes( - final AttributeSource source, - final OuterJoinLoadable ownerEntityPersister, - final CompositeType compositeType, - final String lhsTableName, - final String[] lhsColumns) { - return new Iterable() { - @Override - public Iterator iterator() { - return new Iterator() { - private final int numberOfAttributes = compositeType.getSubtypes().length; - private int currentSubAttributeNumber; - private int currentColumnPosition; - - @Override - public boolean hasNext() { - return currentSubAttributeNumber < numberOfAttributes; - } - - @Override - public AttributeDefinition next() { - final int subAttributeNumber = currentSubAttributeNumber; - currentSubAttributeNumber++; - - final String name = compositeType.getPropertyNames()[subAttributeNumber]; - final Type type = compositeType.getSubtypes()[subAttributeNumber]; - final FetchMode fetchMode = compositeType.getFetchMode( subAttributeNumber ); - - final int columnPosition = currentColumnPosition; - final int columnSpan = type.getColumnSpan( ownerEntityPersister.getFactory() ); - final String[] subAttributeLhsColumns = ArrayHelper.slice( lhsColumns, columnPosition, columnSpan ); - - - final boolean[] propertyNullability = compositeType.getPropertyNullability(); - final boolean nullable = propertyNullability == null || propertyNullability[subAttributeNumber]; - - currentColumnPosition += columnSpan; - - if ( type.isAssociationType() ) { - final AssociationType aType = (AssociationType) type; - return new AssociationAttributeDefinition() { - - @Override - public AssociationKey getAssociationKey() { - return new AssociationKey( lhsTableName, subAttributeLhsColumns ); - } - - - @Override - public AssociationNature getAssociationNature() { - if ( type.isAnyType() ) { - return AssociationNature.ANY; - } - else { - // cannot be a collection - return AssociationNature.ENTITY; - } - } - - @Override - public EntityDefinition toEntityDefinition() { - if ( getAssociationNature() != AssociationNature.ENTITY ) { - throw new WalkingException( - "Cannot build EntityDefinition from non-entity-typed attribute" - ); - } - return (EntityPersister) aType.getAssociatedJoinable( ownerEntityPersister.getFactory() ); - } - - @Override - public AnyMappingDefinition toAnyDefinition() { - if ( getAssociationNature() != AssociationNature.ANY ) { - throw new WalkingException( - "Cannot build AnyMappingDefinition from non-any-typed attribute" - ); - } - // todo : not sure how lazy is propagated into the component for a sub-attribute of type any - return new StandardAnyTypeDefinition( (AnyType) aType, false ); - } - - @Override - public CollectionDefinition toCollectionDefinition() { - throw new WalkingException( "A collection cannot be mapped to a composite ID sub-attribute." ); - } - - @Override - public FetchOptions determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath) { - final FetchStyle style = FetchOptionsHelper.determineFetchStyleByMetadata( - fetchMode, - (AssociationType) type, - ownerEntityPersister.getFactory() - ); - final FetchTiming timing = FetchOptionsHelper.determineFetchTiming( - style, - getType(), - ownerEntityPersister.getFactory() - ); - return FetchOptions.valueOf( timing, style ); - } - - @Override - public CascadeStyle determineCascadeStyle() { - return CascadeStyles.NONE; - } - - @Override - public HydratedCompoundValueHandler getHydratedCompoundValueExtractor() { - return null; - } - - @Override - public String getName() { - return name; - } - - @Override - public AssociationType getType() { - return aType; - } - - @Override - public boolean isNullable() { - return nullable; - } - - @Override - public AttributeSource getSource() { - return source; - } - }; - } - else if ( type.isComponentType() ) { - return new CompositionDefinition() { - @Override - public String getName() { - return name; - } - - @Override - public CompositeType getType() { - return (CompositeType) type; - } - - @Override - public boolean isNullable() { - return nullable; - } - - @Override - public AttributeSource getSource() { - return source; - } - - @Override - public Iterable getAttributes() { - return CompositionSingularSubAttributesHelper.getSingularSubAttributes( - this, - ownerEntityPersister, - (CompositeType) type, - lhsTableName, - subAttributeLhsColumns - ); - } - }; - } - else { - return new AttributeDefinition() { - @Override - public String getName() { - return name; - } - - @Override - public Type getType() { - return type; - } - - @Override - public boolean isNullable() { - return nullable; - } - - @Override - public AttributeSource getSource() { - return source; - } - }; - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException( "Remove operation not supported here" ); - } - }; - } - }; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/EntityIdentifierDefinitionHelper.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/EntityIdentifierDefinitionHelper.java deleted file mode 100644 index 2113b9dc0b..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/EntityIdentifierDefinitionHelper.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.internal; - -import org.hibernate.persister.entity.AbstractEntityPersister; -import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.walking.spi.AttributeDefinition; -import org.hibernate.persister.walking.spi.AttributeSource; -import org.hibernate.persister.walking.spi.CompositionDefinition; -import org.hibernate.persister.walking.spi.EncapsulatedEntityIdentifierDefinition; -import org.hibernate.persister.walking.spi.EntityDefinition; -import org.hibernate.persister.walking.spi.EntityIdentifierDefinition; -import org.hibernate.persister.walking.spi.NonEncapsulatedEntityIdentifierDefinition; -import org.hibernate.type.CompositeType; -import org.hibernate.type.Type; - -/** - * @author Gail Badner - */ -public final class EntityIdentifierDefinitionHelper { - private EntityIdentifierDefinitionHelper() { - } - - public static EntityIdentifierDefinition buildSimpleEncapsulatedIdentifierDefinition(final EntityPersister entityPersister) { - return new EncapsulatedEntityIdentifierDefinition() { - private final AttributeDefinitionAdapter attr = new AttributeDefinitionAdapter( entityPersister); - - @Override - public AttributeDefinition getAttributeDefinition() { - return attr; - } - - @Override - public boolean isEncapsulated() { - return true; - } - - @Override - public EntityDefinition getEntityDefinition() { - return entityPersister; - } - }; - } - - public static EntityIdentifierDefinition buildEncapsulatedCompositeIdentifierDefinition( - final AbstractEntityPersister entityPersister) { - - return new EncapsulatedEntityIdentifierDefinition() { - private final CompositionDefinitionAdapter compositionDefinition = new CompositionDefinitionAdapter( entityPersister ); - - @Override - public AttributeDefinition getAttributeDefinition() { - return compositionDefinition; - } - - @Override - public boolean isEncapsulated() { - return true; - } - - @Override - public EntityDefinition getEntityDefinition() { - return entityPersister; - } - }; - } - - public static EntityIdentifierDefinition buildNonEncapsulatedCompositeIdentifierDefinition(final AbstractEntityPersister entityPersister) { - return new NonEncapsulatedEntityIdentifierDefinition() { - private final CompositionDefinitionAdapter compositionDefinition = new CompositionDefinitionAdapter( entityPersister ); - - @Override - public Iterable getAttributes() { - return compositionDefinition.getAttributes(); - } - - @Override - public Class getSeparateIdentifierMappingClass() { - return entityPersister.getEntityMetamodel().getIdentifierProperty().hasIdentifierMapper() ? - entityPersister.getEntityMetamodel().getIdentifierProperty().getType().getReturnedClass() : - null; - } - - @Override - public boolean isEncapsulated() { - return false; - } - - @Override - public EntityDefinition getEntityDefinition() { - return entityPersister; - } - - @Override - public Type getCompositeType() { - return entityPersister.getEntityMetamodel().getIdentifierProperty().getType(); - } - - @Override - public AttributeSource getSource() { - return compositionDefinition; - } - - @Override - public String getName() { - // Not sure this is always kosher. See org.hibernate.tuple.entity.EntityMetamodel.hasNonIdentifierPropertyNamedId - return "id"; - } - - @Override - public CompositeType getType() { - return (CompositeType) getCompositeType(); - } - - @Override - public boolean isNullable() { - return compositionDefinition.isNullable(); - } - }; - } - - private static class AttributeDefinitionAdapter implements AttributeDefinition { - private final EntityPersister entityPersister; - - AttributeDefinitionAdapter(EntityPersister entityPersister) { - this.entityPersister = entityPersister; - } - - @Override - public String getName() { - return entityPersister.getEntityMetamodel().getIdentifierProperty().getName(); - } - - @Override - public Type getType() { - return entityPersister.getEntityMetamodel().getIdentifierProperty().getType(); - } - - @Override - public boolean isNullable() { - return false; - } - - @Override - public AttributeSource getSource() { - return entityPersister; - } - - @Override - public String toString() { - return ""; - } - - protected EntityPersister getEntityPersister() { - return entityPersister; - } - } - - private static class CompositionDefinitionAdapter extends AttributeDefinitionAdapter implements CompositionDefinition { - CompositionDefinitionAdapter(AbstractEntityPersister entityPersister) { - super( entityPersister ); - } - - @Override - public String toString() { - return ""; - } - - @Override - public CompositeType getType() { - return (CompositeType) super.getType(); - } - - @Override - public Iterable getAttributes() { - return CompositionSingularSubAttributesHelper.getIdentifierSubAttributes( (AbstractEntityPersister) getEntityPersister() ); - } - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/StandardAnyTypeDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/StandardAnyTypeDefinition.java deleted file mode 100644 index 2f4bf6eec6..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/internal/StandardAnyTypeDefinition.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import org.hibernate.persister.walking.spi.AnyMappingDefinition; -import org.hibernate.type.AnyType; -import org.hibernate.type.MetaType; -import org.hibernate.type.Type; - -/** - * @author Steve Ebersole - */ -public class StandardAnyTypeDefinition implements AnyMappingDefinition { - private final AnyType anyType; - private final boolean definedAsLazy; - private final List discriminatorMappings; - - public StandardAnyTypeDefinition(AnyType anyType, boolean definedAsLazy) { - this.anyType = anyType; - this.definedAsLazy = definedAsLazy; - this.discriminatorMappings = interpretDiscriminatorMappings( anyType ); - } - - private static List interpretDiscriminatorMappings(AnyType anyType) { - final Type discriminatorType = anyType.getDiscriminatorType(); - if ( !(discriminatorType instanceof MetaType) ) { - return Collections.emptyList(); - } - - final MetaType metaType = (MetaType) discriminatorType; - final List discriminatorMappings = new ArrayList<>(); - for ( final Map.Entry entry : metaType.getDiscriminatorValuesToEntityNameMap().entrySet() ) { - discriminatorMappings.add( - new DiscriminatorMapping() { - private final Object discriminatorValue = entry.getKey(); - private final String entityName = entry.getValue(); - - @Override - public Object getDiscriminatorValue() { - return discriminatorValue; - } - - @Override - public String getEntityName() { - return entityName; - } - } - ); - } - return discriminatorMappings; - } - - @Override - public AnyType getType() { - return anyType; - } - - @Override - public boolean isLazy() { - return definedAsLazy; - } - - @Override - public Type getIdentifierType() { - return anyType.getIdentifierType(); - } - - @Override - public Type getDiscriminatorType() { - return anyType.getDiscriminatorType(); - } - - @Override - public Iterable getMappingDefinedDiscriminatorMappings() { - return discriminatorMappings; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AnyMappingDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AnyMappingDefinition.java deleted file mode 100644 index ee57e01c35..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AnyMappingDefinition.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.type.AnyType; -import org.hibernate.type.Type; - -/** - * Describes an ANY mapping - * - * @author Steve Ebersole - */ -public interface AnyMappingDefinition { - /** - * Access to the mapping's AnyType - * - * @return The AnyType - */ - AnyType getType(); - - /** - * Was the mapping defined as lazy? - * - * @return true/false - */ - boolean isLazy(); - - /** - * Access to the type of the value that makes up the identifier portion of the AnyType. - * - * @return The identifier type - */ - Type getIdentifierType(); - - /** - * Access to the type of the value that makes up the discriminator portion of the AnyType. The discriminator is - * historically called the "meta". - *

- * NOTE : If explicit discriminator mappings are given, the type here will be a {@link org.hibernate.type.MetaType}. - * - * @return The discriminator type - */ - Type getDiscriminatorType(); - - /** - * Access to discriminator mappings explicitly defined in the mapping metadata. - * - * There are 2 flavors of discrimination:

    - *
  1. - * The database holds the concrete entity names. This is an implicit form, meaning that the discriminator - * mappings do not have to be defined in the mapping metadata. In this case, an empty iterable is returned - * here - *
  2. - *
  3. - * The database holds discriminator values that are interpreted to corresponding entity names based on - * discriminator mappings explicitly supplied in the mapping metadata. In this case, this method gives access - * to those explicitly defined mappings. - *
  4. - *
- * - * @return The explicitly defined discriminator value mappings. - */ - Iterable getMappingDefinedDiscriminatorMappings(); - - /** - * Models a single discriminator mapping definition - */ - interface DiscriminatorMapping { - /** - * Access to the defined discriminator value (the database value) being mapped. - * - * @return The defined discriminator value - */ - Object getDiscriminatorValue(); - - /** - * Access to the defined entity name corresponding to the defined {@link #getDiscriminatorValue()} - * - * @return The defined entity name - */ - String getEntityName(); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationAttributeDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationAttributeDefinition.java deleted file mode 100644 index 7412f6d50f..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationAttributeDefinition.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.engine.spi.CascadeStyle; -import org.hibernate.engine.spi.LoadQueryInfluencers; -import org.hibernate.loader.PropertyPath; -import org.hibernate.persister.spi.HydratedCompoundValueHandler; -import org.hibernate.sql.results.graph.FetchOptions; -import org.hibernate.type.AssociationType; - -/** - * @author Steve Ebersole - */ -public interface AssociationAttributeDefinition extends AttributeDefinition { - @Override - AssociationType getType(); - - AssociationKey getAssociationKey(); - - enum AssociationNature { - ANY, - ENTITY, - COLLECTION - } - - AssociationNature getAssociationNature(); - - EntityDefinition toEntityDefinition(); - - CollectionDefinition toCollectionDefinition(); - - AnyMappingDefinition toAnyDefinition(); - - FetchOptions determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath); - - CascadeStyle determineCascadeStyle(); - - HydratedCompoundValueHandler getHydratedCompoundValueExtractor(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationKey.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationKey.java deleted file mode 100644 index 4179c107d9..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AssociationKey.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import java.util.Arrays; - - -/** - * Used to uniquely identify a foreign key, so that we don't join it more than once creating circularities. Note - * that the table+columns refers to the association owner. These are used to help detect bi-directional associations - * since the Hibernate runtime metamodel (persisters) do not inherently know this information. For example, consider - * the Order -> Customer and Customer -> Order(s) bi-directional association; both would be mapped to the - * {@code ORDER_TABLE.CUST_ID} column. That is the purpose of this struct. - *

- * Bit of a misnomer to call this an association attribute. But this follows the legacy use of AssociationKey - * from old JoinWalkers to denote circular join detection - * - * @author Steve Ebersole - * @author Gail Badner - * @author Gavin King - */ -public class AssociationKey { - private final String table; - private final String[] columns; - - /** - * Create the AssociationKey. - * - * @param table The table part of the association key - * @param columns The columns that define the association key - */ - public AssociationKey(String table, String[] columns) { - this.table = table; - this.columns = columns; - } - - @Override - public boolean equals(Object o) { - if ( this == o ) { - return true; - } - if ( o == null || getClass() != o.getClass() ) { - return false; - } - - final AssociationKey that = (AssociationKey) o; - return table.equals( that.table ) && Arrays.equals( columns, that.columns ); - - } - - @Override - public int hashCode() { - return table.hashCode(); - } - - private String str; - - @Override - public String toString() { - if ( str == null ) { - str = "AssociationKey(table=" + table + ", columns={" + String.join( ",", columns ) + "})"; - } - return str; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeDefinition.java deleted file mode 100644 index dd56b91e83..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeDefinition.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.type.Type; - -/** - * Descriptor for - * @author Steve Ebersole - */ -public interface AttributeDefinition { - AttributeSource getSource(); - String getName(); - Type getType(); - boolean isNullable(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeSource.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeSource.java index 391bddc7b7..e2fc8bb60f 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeSource.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/AttributeSource.java @@ -10,5 +10,4 @@ package org.hibernate.persister.walking.spi; * @author Steve Ebersole */ public interface AttributeSource { - Iterable getAttributes(); } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionDefinition.java deleted file mode 100644 index c80a3a53b7..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionDefinition.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.persister.collection.CollectionPersister; -import org.hibernate.type.CollectionType; - -/** - * @author Steve Ebersole - */ -public interface CollectionDefinition { - CollectionPersister getCollectionPersister(); - CollectionType getCollectionType(); - - CollectionIndexDefinition getIndexDefinition(); - CollectionElementDefinition getElementDefinition(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionElementDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionElementDefinition.java deleted file mode 100644 index 9d0502eaec..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionElementDefinition.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.type.Type; - -/** - * Represents a collection element. - * - * @author Steve Ebersole - */ -public interface CollectionElementDefinition { - - /** - * Returns the collection definition. - * @return the collection definition. - */ - CollectionDefinition getCollectionDefinition(); - - /** - * Returns the collection element type. - * @return the collection element type - */ - Type getType(); - - /** - * If the element type returned by {@link #getType()} is an - * {@link org.hibernate.type.AnyType}, then the any mapping - * definition for the collection element is returned; - * otherwise, IllegalStateException is thrown. - * - * @return the any mapping definition for the collection element. - * - * @throws IllegalStateException if the collection element type - * returned by {@link #getType()} is not of type - * {@link org.hibernate.type.AnyType}. - */ - AnyMappingDefinition toAnyMappingDefinition(); - - /** - * If the element type returned by {@link #getType()} is an - * {@link org.hibernate.type.EntityType}, then the entity - * definition for the collection element is returned; - * otherwise, IllegalStateException is thrown. - * - * @return the entity definition for the collection element. - * - * @throws IllegalStateException if the collection element type - * returned by {@link #getType()} is not of type - * {@link org.hibernate.type.EntityType}. - */ - EntityDefinition toEntityDefinition(); - - /** - * If the element type returned by {@link #getType()} is a - * {@link org.hibernate.type.CompositeType}, then the composite - * element definition for the collection element is returned; - * otherwise, IllegalStateException is thrown. - * - * @return the composite element definition for the collection element. - * - * @throws IllegalStateException if the collection element type - * returned by {@link #getType()} is not of type - * {@link org.hibernate.type.CompositeType}. - */ - CompositeCollectionElementDefinition toCompositeElementDefinition(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionIndexDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionIndexDefinition.java deleted file mode 100644 index 87222543da..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CollectionIndexDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.type.Type; - -/** - * @author Steve Ebersole - */ -public interface CollectionIndexDefinition { - /** - * Returns the collection definition. - * @return the collection definition. - */ - CollectionDefinition getCollectionDefinition(); - /** - * Returns the collection index type. - * @return the collection index type - */ - Type getType(); - /** - * If the index type returned by {@link #getType()} is an - * {@link org.hibernate.type.EntityType}, then the entity - * definition for the collection index is returned; - * otherwise, IllegalStateException is thrown. - * - * @return the entity definition for the collection index. - * - * @throws IllegalStateException if the collection index type - * returned by {@link #getType()} is not of type - * {@link org.hibernate.type.EntityType}. - */ - EntityDefinition toEntityDefinition(); - /** - * If the index type returned by {@link #getType()} is a - * {@link org.hibernate.type.CompositeType}, then the composite - * index definition for the collection index is returned; - * otherwise, IllegalStateException is thrown. - * - * @return the composite index definition for the collection index. - * - * @throws IllegalStateException if the collection index type - * returned by {@link #getType()} is not of type - * {@link org.hibernate.type.CompositeType}. - */ - CompositionDefinition toCompositeDefinition(); - - /** - * If the index type returned by {@link #getType()} is an - * {@link org.hibernate.type.AnyType}, then the any mapping - * definition for the collection index is returned; - * otherwise, IllegalStateException is thrown. - * - * @return the any mapping definition for the collection index. - * - * @throws IllegalStateException if the collection index type - * returned by {@link #getType()} is not of type - * {@link org.hibernate.type.AnyType}. - */ - AnyMappingDefinition toAnyMappingDefinition(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositeCollectionElementDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositeCollectionElementDefinition.java deleted file mode 100644 index 22b5b27d8c..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositeCollectionElementDefinition.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -/** - * The definition for a composite collection element. - * - * @author Gail Badner - */ -public interface CompositeCollectionElementDefinition extends CompositionDefinition{ - /** - * Returns the collection definition. - * @return the collection definition. - */ - CollectionDefinition getCollectionDefinition(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositionDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositionDefinition.java deleted file mode 100644 index 604b2cba8b..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/CompositionDefinition.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.type.CompositeType; - -/** - * @author Steve Ebersole - */ -public interface CompositionDefinition extends AttributeDefinition, AttributeSource { - @Override - CompositeType getType(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EncapsulatedEntityIdentifierDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EncapsulatedEntityIdentifierDefinition.java deleted file mode 100644 index 01d1fecd87..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EncapsulatedEntityIdentifierDefinition.java +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -/** - * @author Steve Ebersole - */ -public interface EncapsulatedEntityIdentifierDefinition extends EntityIdentifierDefinition { - AttributeDefinition getAttributeDefinition(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityDefinition.java deleted file mode 100644 index c87f007e20..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityDefinition.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.persister.entity.EntityPersister; - -/** - * Defines the contract for walking the attributes defined by an entity - * - * @author Steve Ebersole - */ -public interface EntityDefinition extends AttributeSource { - EntityPersister getEntityPersister(); - EntityIdentifierDefinition getEntityKeyDefinition(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityIdentifierDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityIdentifierDefinition.java deleted file mode 100644 index 31ef850e71..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/EntityIdentifierDefinition.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -/** - * Describes aspects of the identifier for an entity - * - * @author Steve Ebersole - */ -public interface EntityIdentifierDefinition { - /** - * Is the entity identifier encapsulated? Meaning, is it represented by a single attribute? - * - * @return {@code true} indicates the identifier is encapsulated (and therefore this is castable to - * {@link EncapsulatedEntityIdentifierDefinition}); {@code false} means it is not encapsulated (and therefore - * castable to {@link NonEncapsulatedEntityIdentifierDefinition}). - * - */ - boolean isEncapsulated(); - - EntityDefinition getEntityDefinition(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/NonEncapsulatedEntityIdentifierDefinition.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/NonEncapsulatedEntityIdentifierDefinition.java deleted file mode 100644 index f2c96f8de1..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/NonEncapsulatedEntityIdentifierDefinition.java +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.type.Type; - -/** - * @author Steve Ebersole - */ -public interface NonEncapsulatedEntityIdentifierDefinition extends EntityIdentifierDefinition, CompositionDefinition { - - Type getCompositeType(); - - Class getSeparateIdentifierMappingClass(); -} diff --git a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/WalkingException.java b/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/WalkingException.java deleted file mode 100644 index 5191f234a7..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/persister/walking/spi/WalkingException.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.persister.walking.spi; - -import org.hibernate.HibernateError; - -/** - * Indicates a problem walking the domain tree. Almost always this indicates an internal error in Hibernate - * - * @author Steve Ebersole - */ -public class WalkingException extends HibernateError { - public WalkingException(String message) { - super( message ); - } - - public WalkingException(String message, Throwable root) { - super( message, root ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/AbstractNonIdentifierAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/AbstractNonIdentifierAttribute.java index 8b4d21e91a..eb38cc770c 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/AbstractNonIdentifierAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/AbstractNonIdentifierAttribute.java @@ -37,7 +37,6 @@ public abstract class AbstractNonIdentifierAttribute extends AbstractAttribute i this.attributeInformation = attributeInformation; } - @Override public AttributeSource getSource() { return source(); } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/NonIdentifierAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/NonIdentifierAttribute.java index aff0b2d9ff..3e49ba7a62 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/NonIdentifierAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/NonIdentifierAttribute.java @@ -8,12 +8,11 @@ package org.hibernate.tuple; import org.hibernate.FetchMode; import org.hibernate.engine.spi.CascadeStyle; -import org.hibernate.persister.walking.spi.AttributeDefinition; /** * @author Steve Ebersole */ -public interface NonIdentifierAttribute extends Attribute, AttributeDefinition { +public interface NonIdentifierAttribute extends Attribute { boolean isLazy(); boolean isInsertable(); diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java b/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java index c9d6408d15..6f710c7761 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/PropertyFactory.java @@ -286,40 +286,4 @@ public final class PropertyFactory { ); } - - private static Constructor getConstructor(PersistentClass persistentClass) { - if ( persistentClass == null || !persistentClass.hasPojoRepresentation() ) { - return null; - } - - try { - return ReflectHelper.getDefaultConstructor( persistentClass.getMappedClass() ); - } - catch (Throwable t) { - return null; - } - } - - private static Getter getGetter(Property mappingProperty) { - if ( mappingProperty == null || !mappingProperty.getPersistentClass().hasPojoRepresentation() ) { - return null; - } - - final PropertyAccessStrategyResolver propertyAccessStrategyResolver = - mappingProperty.getPersistentClass().getServiceRegistry().getService( PropertyAccessStrategyResolver.class ); - - final PropertyAccessStrategy propertyAccessStrategy = propertyAccessStrategyResolver.resolvePropertyAccessStrategy( - mappingProperty.getClass(), - mappingProperty.getPropertyAccessorName(), - RepresentationMode.POJO - ); - - final PropertyAccess propertyAccess = propertyAccessStrategy.buildPropertyAccess( - mappingProperty.getPersistentClass().getMappedClass(), - mappingProperty.getName(), - true ); - - return propertyAccess.getGetter(); - } - } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java index 1c61298fed..9cc8b6ed2d 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/AbstractCompositionAttribute.java @@ -6,28 +6,12 @@ */ package org.hibernate.tuple.component; -import java.util.Iterator; - -import org.hibernate.engine.internal.JoinHelper; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.entity.Joinable; -import org.hibernate.persister.entity.OuterJoinLoadable; -import org.hibernate.persister.walking.spi.AssociationKey; -import org.hibernate.persister.walking.spi.AttributeDefinition; import org.hibernate.persister.walking.spi.AttributeSource; -import org.hibernate.persister.walking.spi.CompositionDefinition; import org.hibernate.tuple.AbstractNonIdentifierAttribute; import org.hibernate.tuple.BaselineAttributeInformation; -import org.hibernate.type.AssociationType; import org.hibernate.type.CompositeType; -import org.hibernate.type.ForeignKeyDirection; -import org.hibernate.type.Type; - -import static org.hibernate.engine.internal.JoinHelper.getLHSColumnNames; -import static org.hibernate.engine.internal.JoinHelper.getLHSTableName; -import static org.hibernate.engine.internal.JoinHelper.getRHSColumnNames; /** * A base class for a composite, non-identifier attribute. @@ -36,7 +20,7 @@ import static org.hibernate.engine.internal.JoinHelper.getRHSColumnNames; */ public abstract class AbstractCompositionAttribute extends AbstractNonIdentifierAttribute - implements CompositionDefinition { + implements AttributeSource { private final int columnStartPosition; @@ -57,159 +41,6 @@ public abstract class AbstractCompositionAttribute return (CompositeType) super.getType(); } - @Override - public Iterable getAttributes() { - return () -> new Iterator<>() { - private final int numberOfAttributes = getType().getSubtypes().length; - private int currentSubAttributeNumber; - private int currentColumnPosition = columnStartPosition; - - @Override - public boolean hasNext() { - return currentSubAttributeNumber < numberOfAttributes; - } - - @Override - public AttributeDefinition next() { - final int subAttributeNumber = currentSubAttributeNumber; - currentSubAttributeNumber++; - - final String name = getType().getPropertyNames()[subAttributeNumber]; - final Type type = getType().getSubtypes()[subAttributeNumber]; - - int columnPosition = currentColumnPosition; - currentColumnPosition += type.getColumnSpan( sessionFactory() ); - - final CompositeType cType = getType(); - final boolean nullable = - cType.getPropertyNullability() == null || - cType.getPropertyNullability()[subAttributeNumber]; - - if ( type.isAssociationType() ) { - // we build the association-key here because of the "goofiness" with 'currentColumnPosition' - final AssociationKey associationKey; - final AssociationType aType = (AssociationType) type; - - if ( aType.isAnyType() ) { - associationKey = new AssociationKey( - JoinHelper.getLHSTableName( - aType, - attributeNumber(), - (OuterJoinLoadable) locateOwningPersister() - ), - JoinHelper.getLHSColumnNames( - aType, - attributeNumber(), - columnPosition, - (OuterJoinLoadable) locateOwningPersister(), - sessionFactory() - ) - ); - } - else if ( aType.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) { - final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() ); - - final String lhsTableName; - final String[] lhsColumnNames; - - if ( joinable.isCollection() ) { - final QueryableCollection collectionPersister = (QueryableCollection) joinable; - lhsTableName = collectionPersister.getTableName(); - lhsColumnNames = collectionPersister.getElementColumnNames(); - } - else { - final OuterJoinLoadable entityPersister = (OuterJoinLoadable) locateOwningPersister(); - lhsTableName = getLHSTableName( aType, attributeNumber(), entityPersister ); - lhsColumnNames = getLHSColumnNames( - aType, - attributeNumber(), - columnPosition, - entityPersister, - sessionFactory() - ); - } - associationKey = new AssociationKey( lhsTableName, lhsColumnNames ); - } - else { - final Joinable joinable = aType.getAssociatedJoinable( sessionFactory() ); - - associationKey = new AssociationKey( - joinable.getTableName(), - getRHSColumnNames( aType, sessionFactory() ) - ); - } - - return new CompositeBasedAssociationAttribute( - AbstractCompositionAttribute.this, - sessionFactory(), - attributeNumber(), - name, - (AssociationType) type, - new BaselineAttributeInformation.Builder() - .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) - .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) - // todo : handle nested ValueGeneration strategies... - // disallow if our strategy != NEVER - .setNullable( nullable ) - .setDirtyCheckable( true ) - .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) - .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) - .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) - .createInformation(), - subAttributeNumber, - associationKey - ); - } - else if ( type.isComponentType() ) { - return new CompositionBasedCompositionAttribute( - AbstractCompositionAttribute.this, - sessionFactory(), - attributeNumber(), - name, - (CompositeType) type, - columnPosition, - new BaselineAttributeInformation.Builder() - .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) - .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) - // todo : handle nested ValueGeneration strategies... - // disallow if our strategy != NEVER - .setNullable( nullable ) - .setDirtyCheckable( true ) - .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) - .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) - .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) - .createInformation() - ); - } - else { - return new CompositeBasedBasicAttribute( - AbstractCompositionAttribute.this, - sessionFactory(), - subAttributeNumber, - name, - type, - new BaselineAttributeInformation.Builder() - .setInsertable( AbstractCompositionAttribute.this.isInsertable() ) - .setUpdateable( AbstractCompositionAttribute.this.isUpdateable() ) - // todo : handle nested ValueGeneration strategies... - // disallow if our strategy != NEVER - .setNullable( nullable ) - .setDirtyCheckable( true ) - .setVersionable( AbstractCompositionAttribute.this.isVersionable() ) - .setCascadeStyle( getType().getCascadeStyle( subAttributeNumber ) ) - .setFetchMode( getType().getFetchMode( subAttributeNumber ) ) - .createInformation() - ); - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException( "Remove operation not supported here" ); - } - }; - } - protected abstract EntityPersister locateOwningPersister(); @Override diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedAssociationAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedAssociationAttribute.java deleted file mode 100644 index df8bb2b86c..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedAssociationAttribute.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.tuple.component; - -import org.hibernate.FetchMode; -import org.hibernate.engine.FetchStyle; -import org.hibernate.engine.FetchTiming; -import org.hibernate.engine.spi.CascadeStyle; -import org.hibernate.engine.spi.LoadQueryInfluencers; -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.loader.PropertyPath; -import org.hibernate.persister.collection.CollectionPersister; -import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.entity.Joinable; -import org.hibernate.persister.spi.HydratedCompoundValueHandler; -import org.hibernate.persister.walking.internal.FetchOptionsHelper; -import org.hibernate.persister.walking.internal.StandardAnyTypeDefinition; -import org.hibernate.persister.walking.spi.AnyMappingDefinition; -import org.hibernate.persister.walking.spi.AssociationAttributeDefinition; -import org.hibernate.persister.walking.spi.AssociationKey; -import org.hibernate.persister.walking.spi.CollectionDefinition; -import org.hibernate.persister.walking.spi.EntityDefinition; -import org.hibernate.persister.walking.spi.WalkingException; -import org.hibernate.sql.results.graph.FetchOptions; -import org.hibernate.tuple.AbstractNonIdentifierAttribute; -import org.hibernate.tuple.BaselineAttributeInformation; -import org.hibernate.tuple.NonIdentifierAttribute; -import org.hibernate.type.AnyType; -import org.hibernate.type.AssociationType; - -/** - * @author Steve Ebersole - */ -public class CompositeBasedAssociationAttribute - extends AbstractNonIdentifierAttribute - implements NonIdentifierAttribute, AssociationAttributeDefinition { - - private final int subAttributeNumber; - private final AssociationKey associationKey; - private Joinable joinable; - - public CompositeBasedAssociationAttribute( - AbstractCompositionAttribute source, - SessionFactoryImplementor factory, - int entityBasedAttributeNumber, - String attributeName, - AssociationType attributeType, - BaselineAttributeInformation baselineInfo, - int subAttributeNumber, - AssociationKey associationKey) { - super( source, factory, entityBasedAttributeNumber, attributeName, attributeType, baselineInfo ); - this.subAttributeNumber = subAttributeNumber; - this.associationKey = associationKey; - } - - @Override - public AssociationType getType() { - return (AssociationType) super.getType(); - } - - @Override - public AbstractCompositionAttribute getSource() { - return (AbstractCompositionAttribute) super.getSource(); - } - - protected Joinable getJoinable() { - if ( joinable == null ) { - joinable = getType().getAssociatedJoinable( sessionFactory() ); - } - return joinable; - } - - @Override - public AssociationKey getAssociationKey() { - return associationKey; - } - - @Override - public AssociationNature getAssociationNature() { - if ( getType().isAnyType() ) { - return AssociationNature.ANY; - } - else { - if ( getJoinable().isCollection() ) { - return AssociationNature.COLLECTION; - } - else { - return AssociationNature.ENTITY; - } - } - } - - private boolean isAnyType() { - return getAssociationNature() == AssociationNature.ANY; - } - - private boolean isEntityType() { - return getAssociationNature() == AssociationNature.ENTITY; - } - - private boolean isCollection() { - return getAssociationNature() == AssociationNature.COLLECTION; - } - - @Override - public AnyMappingDefinition toAnyDefinition() { - if ( !isAnyType() ) { - throw new WalkingException( "Cannot build AnyMappingDefinition from non-any-typed attribute" ); - } - // todo : not sure how lazy is propogated into the component for a subattribute of type any - return new StandardAnyTypeDefinition( (AnyType) getType(), false ); - } - - @Override - public EntityDefinition toEntityDefinition() { - if ( isCollection() ) { - throw new IllegalStateException( "Cannot treat collection attribute as entity type" ); - } - if ( isAnyType() ) { - throw new IllegalStateException( "Cannot treat any-type attribute as entity type" ); - } - return (EntityPersister) getJoinable(); - } - - @Override - public CollectionDefinition toCollectionDefinition() { - if ( isEntityType() ) { - throw new IllegalStateException( "Cannot treat entity attribute as collection type" ); - } - if ( isAnyType() ) { - throw new IllegalStateException( "Cannot treat any-type attribute as collection type" ); - } - return (CollectionPersister) getJoinable(); - } - - @Override - public FetchOptions determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath) { - final EntityPersister owningPersister = getSource().locateOwningPersister(); - - FetchStyle style = FetchOptionsHelper.determineFetchStyleByProfile( - loadQueryInfluencers, - owningPersister, - propertyPath, - attributeNumber() - ); - if ( style == null ) { - style = determineFetchStyleByMetadata( getFetchMode(), getType() ); - } - - return FetchOptions.valueOf( determineFetchTiming( style ), style ); - } - - protected FetchStyle determineFetchStyleByMetadata(FetchMode fetchMode, AssociationType type) { - return FetchOptionsHelper.determineFetchStyleByMetadata( fetchMode, type, sessionFactory() ); - } - - private FetchTiming determineFetchTiming(FetchStyle style) { - return FetchOptionsHelper.determineFetchTiming( style, getType(), sessionFactory() ); - } - - @Override - public CascadeStyle determineCascadeStyle() { - return getCascadeStyle(); - } - - private HydratedCompoundValueHandler hydratedCompoundValueHandler; - - @Override - public HydratedCompoundValueHandler getHydratedCompoundValueExtractor() { - if ( hydratedCompoundValueHandler == null ) { - hydratedCompoundValueHandler = new HydratedCompoundValueHandler() { - @Override - public Object extract(Object hydratedState) { - return ( (Object[] ) hydratedState )[ subAttributeNumber ]; - } - - @Override - public void inject(Object hydratedState, Object value) { - ( (Object[] ) hydratedState )[ subAttributeNumber ] = value; - } - }; - } - return hydratedCompoundValueHandler; - } - - @Override - protected String loggableMetadata() { - return super.loggableMetadata() + ",association"; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedBasicAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedBasicAttribute.java deleted file mode 100644 index 73f66fab48..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositeBasedBasicAttribute.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.tuple.component; - -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.persister.walking.spi.AttributeSource; -import org.hibernate.tuple.AbstractNonIdentifierAttribute; -import org.hibernate.tuple.BaselineAttributeInformation; -import org.hibernate.type.Type; - -/** - * @author Steve Ebersole - */ -public class CompositeBasedBasicAttribute extends AbstractNonIdentifierAttribute { - protected CompositeBasedBasicAttribute( - AttributeSource source, - SessionFactoryImplementor sessionFactory, - int attributeNumber, - String attributeName, - Type attributeType, - BaselineAttributeInformation baselineInfo) { - super( source, sessionFactory, attributeNumber, attributeName, attributeType, baselineInfo ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java deleted file mode 100644 index b8893303b9..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/CompositionBasedCompositionAttribute.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Hibernate, Relational Persistence for Idiomatic Java - * - * License: GNU Lesser General Public License (LGPL), version 2.1 or later. - * See the lgpl.txt file in the root directory or . - */ -package org.hibernate.tuple.component; - -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.walking.spi.EntityDefinition; -import org.hibernate.tuple.BaselineAttributeInformation; -import org.hibernate.type.CompositeType; - -/** - * @author Steve Ebersole - */ -public class CompositionBasedCompositionAttribute extends AbstractCompositionAttribute { - - public CompositionBasedCompositionAttribute( - AbstractCompositionAttribute source, - SessionFactoryImplementor sessionFactory, - int entityBasedAttributeNumber, - String attributeName, - CompositeType attributeType, - int columnStartPosition, - BaselineAttributeInformation baselineInfo) { - super( - source, - sessionFactory, - entityBasedAttributeNumber, - attributeName, - attributeType, - columnStartPosition, - baselineInfo - ); - } - - @Override - protected EntityPersister locateOwningPersister() { - final AbstractCompositionAttribute source = (AbstractCompositionAttribute) getSource(); - if (source.getSource() instanceof EntityDefinition) { - return ( (EntityDefinition) source.getSource() ).getEntityPersister(); - } - else { - return ( (AbstractCompositionAttribute) source.getSource() ).locateOwningPersister(); - } - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedAssociationAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedAssociationAttribute.java index 3effc195d8..6ac4f3ab4b 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedAssociationAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedAssociationAttribute.java @@ -6,42 +6,16 @@ */ package org.hibernate.tuple.entity; -import org.hibernate.engine.FetchStyle; -import org.hibernate.engine.FetchTiming; -import org.hibernate.engine.internal.JoinHelper; -import org.hibernate.engine.spi.CascadeStyle; -import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.loader.PropertyPath; -import org.hibernate.persister.collection.QueryableCollection; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.entity.Joinable; -import org.hibernate.persister.entity.OuterJoinLoadable; -import org.hibernate.persister.spi.HydratedCompoundValueHandler; -import org.hibernate.persister.walking.internal.FetchOptionsHelper; -import org.hibernate.persister.walking.internal.StandardAnyTypeDefinition; -import org.hibernate.persister.walking.spi.AnyMappingDefinition; -import org.hibernate.persister.walking.spi.AssociationAttributeDefinition; -import org.hibernate.persister.walking.spi.AssociationKey; -import org.hibernate.persister.walking.spi.CollectionDefinition; -import org.hibernate.persister.walking.spi.EntityDefinition; -import org.hibernate.persister.walking.spi.WalkingException; -import org.hibernate.sql.results.graph.FetchOptions; import org.hibernate.tuple.BaselineAttributeInformation; -import org.hibernate.type.AnyType; import org.hibernate.type.AssociationType; -import org.hibernate.type.ForeignKeyDirection; - -import static org.hibernate.engine.internal.JoinHelper.getLHSColumnNames; -import static org.hibernate.engine.internal.JoinHelper.getLHSTableName; -import static org.hibernate.engine.internal.JoinHelper.getRHSColumnNames; /** * @author Steve Ebersole */ public class EntityBasedAssociationAttribute - extends AbstractEntityBasedAttribute - implements AssociationAttributeDefinition { + extends AbstractEntityBasedAttribute { public EntityBasedAssociationAttribute( @@ -58,151 +32,6 @@ public class EntityBasedAssociationAttribute public AssociationType getType() { return (AssociationType) super.getType(); } - @Override - public AssociationKey getAssociationKey() { - final AssociationType type = getType(); - - if ( type.isAnyType() ) { - return new AssociationKey( - JoinHelper.getLHSTableName( type, attributeNumber(), (OuterJoinLoadable) getSource() ), - JoinHelper.getLHSColumnNames( - type, - attributeNumber(), - 0, - (OuterJoinLoadable) getSource(), - sessionFactory() - ) - ); - } - - final Joinable joinable = type.getAssociatedJoinable( sessionFactory() ); - - if ( type.getForeignKeyDirection() == ForeignKeyDirection.FROM_PARENT ) { - final String lhsTableName; - final String[] lhsColumnNames; - - if ( joinable.isCollection() ) { - final QueryableCollection collectionPersister = (QueryableCollection) joinable; - lhsTableName = collectionPersister.getTableName(); - lhsColumnNames = collectionPersister.getElementColumnNames(); - } - else { - final OuterJoinLoadable entityPersister = (OuterJoinLoadable) source(); - lhsTableName = getLHSTableName( type, attributeNumber(), entityPersister ); - lhsColumnNames = getLHSColumnNames( type, attributeNumber(), entityPersister, sessionFactory() ); - } - return new AssociationKey( lhsTableName, lhsColumnNames ); - } - else { - return new AssociationKey( joinable.getTableName(), getRHSColumnNames( type, sessionFactory() ) ); - } - } - - @Override - public AssociationNature getAssociationNature() { - if ( getType().isAnyType() ) { - return AssociationNature.ANY; - } - else { - if ( getType().isCollectionType() ) { - return AssociationNature.COLLECTION; - } - else { - return AssociationNature.ENTITY; - } - } - } - - @Override - public AnyMappingDefinition toAnyDefinition() { - return new StandardAnyTypeDefinition( - (AnyType) getType(), - getSource().getEntityMetamodel().getProperties()[ attributeNumber() ].isLazy() - ); - } - - private Joinable joinable; - - protected Joinable getJoinable() { - if ( getAssociationNature() == AssociationNature.ANY ) { - throw new WalkingException( "Cannot resolve AnyType to a Joinable" ); - } - - if ( joinable == null ) { - joinable = getType().getAssociatedJoinable( sessionFactory() ); - } - return joinable; - } - - @Override - public EntityDefinition toEntityDefinition() { - if ( getAssociationNature() == AssociationNature.ANY ) { - throw new WalkingException( "Cannot treat any-type attribute as an entity type" ); - } - if ( getAssociationNature() == AssociationNature.COLLECTION ) { - throw new IllegalStateException( "Cannot treat collection-valued attribute as entity type" ); - } - return (EntityPersister) getJoinable(); - } - - @Override - public CollectionDefinition toCollectionDefinition() { - if ( getAssociationNature() == AssociationNature.ANY ) { - throw new WalkingException( "Cannot treat any-type attribute as a collection type" ); - } - if ( getAssociationNature() == AssociationNature.ENTITY ) { - throw new IllegalStateException( "Cannot treat entity-valued attribute as collection type" ); - } - return (QueryableCollection) getJoinable(); - } - - @Override - public FetchOptions determineFetchPlan(LoadQueryInfluencers loadQueryInfluencers, PropertyPath propertyPath) { - final EntityPersister owningPersister = getSource().getEntityPersister(); - - FetchStyle style = FetchOptionsHelper.determineFetchStyleByProfile( - loadQueryInfluencers, - owningPersister, - propertyPath, - attributeNumber() - ); - if ( style == null ) { - style = FetchOptionsHelper.determineFetchStyleByMetadata( - ( (OuterJoinLoadable) getSource().getEntityPersister() ).getFetchMode( attributeNumber() ), - getType(), - sessionFactory() - ); - } - - final FetchTiming timing = FetchOptionsHelper.determineFetchTiming( style, getType(), sessionFactory() ); - - return FetchOptions.valueOf( timing, style ); - } - - @Override - public CascadeStyle determineCascadeStyle() { - return getSource().getEntityPersister().getPropertyCascadeStyles()[attributeNumber()]; - } - - private HydratedCompoundValueHandler hydratedCompoundValueHandler; - - @Override - public HydratedCompoundValueHandler getHydratedCompoundValueExtractor() { - if ( hydratedCompoundValueHandler == null ) { - hydratedCompoundValueHandler = new HydratedCompoundValueHandler() { - @Override - public Object extract(Object hydratedState) { - return ( (Object[] ) hydratedState )[ attributeNumber() ]; - } - - @Override - public void inject(Object hydratedState, Object value) { - ( (Object[] ) hydratedState )[ attributeNumber() ] = value; - } - }; - } - return hydratedCompoundValueHandler; - } @Override protected String loggableMetadata() { diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedCompositionAttribute.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedCompositionAttribute.java index ea1ebdeeeb..9abf2809f4 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedCompositionAttribute.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityBasedCompositionAttribute.java @@ -8,7 +8,7 @@ package org.hibernate.tuple.entity; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.persister.walking.spi.CompositionDefinition; +import org.hibernate.persister.walking.spi.AttributeSource; import org.hibernate.tuple.BaselineAttributeInformation; import org.hibernate.tuple.component.AbstractCompositionAttribute; import org.hibernate.type.CompositeType; @@ -18,7 +18,7 @@ import org.hibernate.type.CompositeType; */ public class EntityBasedCompositionAttribute extends AbstractCompositionAttribute - implements CompositionDefinition { + implements AttributeSource { public EntityBasedCompositionAttribute( EntityPersister source, diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java index 98c397791a..377cb8481b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/cfg/persister/GoofyPersisterClassProvider.java @@ -35,7 +35,6 @@ import org.hibernate.engine.spi.EntityEntryFactory; import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.engine.spi.ValueInclusion; import org.hibernate.id.IdentifierGenerator; import org.hibernate.internal.FilterAliasGenerator; import org.hibernate.loader.ast.spi.MultiIdLoadOptions; @@ -59,10 +58,6 @@ import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.spi.PersisterClassResolver; import org.hibernate.persister.spi.PersisterCreationContext; -import org.hibernate.persister.walking.spi.AttributeDefinition; -import org.hibernate.persister.walking.spi.CollectionElementDefinition; -import org.hibernate.persister.walking.spi.CollectionIndexDefinition; -import org.hibernate.persister.walking.spi.EntityIdentifierDefinition; import org.hibernate.query.spi.NavigablePath; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy; import org.hibernate.sql.ast.Clause; @@ -114,10 +109,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver { return new BytecodeEnhancementMetadataNonPojoImpl( null ); } - @Override - public void generateEntityDefinition() { - } - @Override public void postInstantiate() throws MappingException { @@ -734,16 +725,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver { return null; } - @Override - public EntityIdentifierDefinition getEntityKeyDefinition() { - return null; //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public Iterable getAttributes() { - throw new NotYetImplementedException(); - } - @Override public int[] resolveAttributeIndexes(String[] attributeNames) { return null; @@ -815,25 +796,10 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver { return null; //To change body of implemented methods use File | Settings | File Templates. } - @Override - public CollectionPersister getCollectionPersister() { - return this; - } - public CollectionType getCollectionType() { throw new NotYetImplementedException(); } - @Override - public CollectionIndexDefinition getIndexDefinition() { - throw new NotYetImplementedException(); - } - - @Override - public CollectionElementDefinition getElementDefinition() { - throw new NotYetImplementedException(); - } - public Type getKeyType() { return null; //To change body of implemented methods use File | Settings | File Templates. } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java index e7d7c741cf..3dbfbd4424 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/BatchFetchStrategyHelperTest.java @@ -23,7 +23,7 @@ import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchTiming; import org.hibernate.persister.entity.OuterJoinLoadable; import org.hibernate.persister.entity.UniqueKeyLoadable; -import org.hibernate.persister.walking.internal.FetchOptionsHelper; +import org.hibernate.metamodel.mapping.internal.FetchOptionsHelper; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.type.AssociationType; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java index 3de0242f79..22a290155a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/FetchStrategyHelperTest.java @@ -22,7 +22,7 @@ import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchTiming; import org.hibernate.persister.entity.OuterJoinLoadable; import org.hibernate.persister.entity.UniqueKeyLoadable; -import org.hibernate.persister.walking.internal.FetchOptionsHelper; +import org.hibernate.metamodel.mapping.internal.FetchOptionsHelper; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.type.AssociationType; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java index dcfe8bfcd3..5e6f40bdf0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/fetchstrategyhelper/NoProxyFetchStrategyHelperTest.java @@ -20,7 +20,7 @@ import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchTiming; import org.hibernate.persister.entity.OuterJoinLoadable; import org.hibernate.persister.entity.UniqueKeyLoadable; -import org.hibernate.persister.walking.internal.FetchOptionsHelper; +import org.hibernate.metamodel.mapping.internal.FetchOptionsHelper; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.type.AssociationType; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java index 2a6aa7705a..1d3dcd4ae6 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/ejb3configuration/PersisterClassProviderTest.java @@ -56,8 +56,6 @@ import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.internal.PersisterClassResolverInitiator; import org.hibernate.persister.spi.PersisterClassResolver; import org.hibernate.persister.spi.PersisterCreationContext; -import org.hibernate.persister.walking.spi.AttributeDefinition; -import org.hibernate.persister.walking.spi.EntityIdentifierDefinition; import org.hibernate.query.spi.NavigablePath; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; @@ -132,10 +130,6 @@ public class PersisterClassProviderTest { return new BytecodeEnhancementMetadataNonPojoImpl( getEntityName() ); } - @Override - public void generateEntityDefinition() { - } - @Override public void postInstantiate() throws MappingException { @@ -714,16 +708,6 @@ public class PersisterClassProviderTest { return this; } - @Override - public EntityIdentifierDefinition getEntityKeyDefinition() { - return null; - } - - @Override - public Iterable getAttributes() { - return null; - } - @Override public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) { return false; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java index fee568e7b8..07e4f0d0ce 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/CustomPersister.java @@ -55,8 +55,6 @@ import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.spi.EntityRepresentationStrategy; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.spi.PersisterCreationContext; -import org.hibernate.persister.walking.spi.AttributeDefinition; -import org.hibernate.persister.walking.spi.EntityIdentifierDefinition; import org.hibernate.query.spi.NavigablePath; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy; import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy; @@ -119,10 +117,6 @@ public class CustomPersister implements EntityPersister { return Custom.class; } - @Override - public void generateEntityDefinition() { - } - public void postInstantiate() throws MappingException {} public String getEntityName() { @@ -822,16 +816,6 @@ public class CustomPersister implements EntityPersister { return null; } - @Override - public EntityIdentifierDefinition getEntityKeyDefinition() { - throw new NotYetImplementedException(); - } - - @Override - public Iterable getAttributes() { - throw new NotYetImplementedException(); - } - @Override public int[] resolveAttributeIndexes(String[] attributeNames) { return null;