diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Association.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Association.java index a8360d5a3f..6df8b4ce60 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Association.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Association.java @@ -9,9 +9,18 @@ package org.hibernate.metamodel.mapping; import org.hibernate.sql.results.graph.Fetchable; /** + * Commonality for an association, mainly details relative to the foreign-key + * * @author Steve Ebersole */ public interface Association extends Fetchable { + /** + * The descriptor, allowing access to column(s), etc + */ ForeignKeyDescriptor getForeignKeyDescriptor(); + + /** + * Indicates which "side" of the foreign-key this association describes + */ ForeignKeyDescriptor.Nature getSideNature(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AssociationKey.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AssociationKey.java index bca5354c12..556df1081d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AssociationKey.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AssociationKey.java @@ -9,6 +9,13 @@ package org.hibernate.metamodel.mapping; import java.util.List; /** + * Used as part of circularity detection + *

+ * Uniquely distinguishes a side of the foreign-key, using + * that side's table and column(s) + * + * @see Association#resolveCircularFetch + * * @author Andrea Boriero */ public class AssociationKey { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AttributeMapping.java index 1702896938..a230053b01 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/AttributeMapping.java @@ -6,8 +6,6 @@ */ package org.hibernate.metamodel.mapping; -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.sql.results.graph.Fetchable; import org.hibernate.tuple.ValueGeneration; @@ -20,6 +18,9 @@ import org.hibernate.type.descriptor.java.MutabilityPlanExposer; * @author Steve Ebersole */ public interface AttributeMapping extends ModelPart, ValueMapping, Fetchable, PropertyBasedMapping, MutabilityPlanExposer { + /** + * The name of the mapped attribute + */ String getAttributeName(); @Override @@ -27,8 +28,14 @@ public interface AttributeMapping extends ModelPart, ValueMapping, Fetchable, Pr return getAttributeName(); } + /** + * Access to AttributeMetadata + */ AttributeMetadataAccess getAttributeMetadataAccess(); + /** + * The managed type that declares this attribute + */ ManagedMappingType getDeclaringType(); /** @@ -37,12 +44,15 @@ public interface AttributeMapping extends ModelPart, ValueMapping, Fetchable, Pr PropertyAccess getPropertyAccess(); /** - * Convenient access to getting the value for this attribute from the "owner" + * Convenient access to getting the value for this attribute from the declarer */ default Object getValue(Object container) { return getPropertyAccess().getGetter().get( container ); } + /** + * Convenient access to setting the value for this attribute on the declarer + */ default void setValue(Object container, Object value) { getPropertyAccess().getSetter().set( container, value ); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicEntityIdentifierMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicEntityIdentifierMapping.java index 5b75c6d00d..cfc6c11ecb 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicEntityIdentifierMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicEntityIdentifierMapping.java @@ -9,6 +9,8 @@ package org.hibernate.metamodel.mapping; import org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping; /** + * Mapping for a simple identifier + * * @author Steve Ebersole */ public interface BasicEntityIdentifierMapping extends SingleAttributeIdentifierMapping, BasicValuedModelPart { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedMapping.java index 45e2bd1112..d826e9b882 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedMapping.java @@ -10,13 +10,11 @@ import java.util.Collections; import java.util.List; /** - * Any basic-typed ValueMapping - e.g. a basic-valued singular attribute or a - * basic-valued collection element - * - * todo (6.0) : better to use {@link org.hibernate.metamodel.relational.Identifier} instead to handle quoting? - * - * todo (6.0) : expose {@link org.hibernate.metamodel.model.convert.spi.BasicValueConverter}? - * - Or just handle internal to impl? + * Any basic-typed ValueMapping. Generally this would be one of

* * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedModelPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedModelPart.java index ade6642a8a..c76e1bed11 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedModelPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/BasicValuedModelPart.java @@ -9,6 +9,11 @@ package org.hibernate.metamodel.mapping; import org.hibernate.sql.results.graph.Fetchable; /** + * Describes a ModelPart which is a basic value, either + * * @author Steve Ebersole */ public interface BasicValuedModelPart extends BasicValuedMapping, ModelPart, Fetchable, SelectableMapping { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Bindable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Bindable.java index bdddab3ae0..64d3d6da4b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Bindable.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Bindable.java @@ -15,32 +15,13 @@ import org.hibernate.mapping.IndexedConsumer; import org.hibernate.sql.ast.Clause; /** - * Contract for things at the domain/mapping level that can be bound into a JDBC - * query. - * - * Notice that there may be more than one JDBC parameter involved here - an embedded value, e.g. + * Contract for things at the domain mapping level that can be bound + * into a JDBC {@link java.sql.PreparedStatement}. * * @author Steve Ebersole */ @Incubating public interface Bindable extends JdbcMappingContainer { - /* - * todo (6.0) : much of this contract uses Clause which (1) kludgy and (2) not always necessary - * - e.g. see the note below wrt "2 forms of JDBC-type visiting" - * - * Instead, in keeping with the general shift away from the getter paradigm to a more functional (Consumer, - * Function, etc) paradigm, I propose something more like: - * - * interface Bindable { - * void apply(UpdateStatement sqlAst, ..., SqlAstCreationState creationState); - * void apply(DeleteStatement sqlAst, ..., SqlAstCreationState creationState); - * - * Expression toSqlAst(..., SqlAstCreationState creationState); - * - * // plus the `DomainResult`, `Fetch` (via `DomainResultProducer` and `Fetchable`) - * // handling most impls already provide - * } - */ /** * The number of JDBC mappings @@ -58,8 +39,6 @@ public interface Bindable extends JdbcMappingContainer { return results; } - // todo (6.0) : why did I do 2 forms of JDBC-type visiting? in-flight change? - /** * Visit each of JdbcMapping * @@ -152,8 +131,6 @@ public interface Bindable extends JdbcMappingContainer { * * Short-hand form of calling {@link #disassemble} and piping its result to * {@link #forEachDisassembledJdbcValue} - * - * todo (6.0) : Would this would ever be used? */ default int forEachJdbcValue( Object value, diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionMappingType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionMappingType.java index 58d127a6d2..ec8f99dc0d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionMappingType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionMappingType.java @@ -9,8 +9,7 @@ package org.hibernate.metamodel.mapping; import org.hibernate.collection.spi.CollectionSemantics; /** - * MappingType for collections. Not that this is the descriptor for - * the collection Java type (List, Set, etc) + * MappingType descriptor for the collection Java type (List, Set, etc) * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionPart.java index 5f49351753..1c18adedac 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CollectionPart.java @@ -10,6 +10,13 @@ import org.hibernate.sql.results.graph.Fetchable; import org.hibernate.type.descriptor.java.JavaTypedExpressible; /** + * Hibernate understands mapping a collection into 4 parts
    + *
  1. The key - the foreign-key defining the association to the owner
  2. + *
  3. The element - for Map's this is analogous to the value
  4. + *
  5. The index - the List/array index or Map key
  6. + *
  7. The collection-id - this is only relevant for id-bag mappings
  8. + *
+ * * @author Steve Ebersole */ public interface CollectionPart extends ModelPart, Fetchable, JavaTypedExpressible { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CompositeIdentifierMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CompositeIdentifierMapping.java index 83efa9ebb3..91d1c4bd62 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CompositeIdentifierMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/CompositeIdentifierMapping.java @@ -10,7 +10,7 @@ package org.hibernate.metamodel.mapping; import org.hibernate.engine.spi.IdentifierValue; /** - * Support for composite identifier mappings + * Mapping for a composite identifier * * @author Andrea Boriero */ diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/ConvertibleModelPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/ConvertibleModelPart.java index 3c77e35b44..37ca1a6dee 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/ConvertibleModelPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/ConvertibleModelPart.java @@ -9,6 +9,8 @@ package org.hibernate.metamodel.mapping; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; /** + * A BasicValuedModelPart which can have a converter associated with it + * * @author Steve Ebersole */ public interface ConvertibleModelPart extends BasicValuedModelPart { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Discriminatable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Discriminatable.java index 4ac1222de6..30279165ea 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Discriminatable.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Discriminatable.java @@ -6,10 +6,8 @@ */ package org.hibernate.metamodel.mapping; -import java.util.Map; import java.util.function.Consumer; -import org.hibernate.Filter; import org.hibernate.sql.ast.spi.SqlAstCreationState; import org.hibernate.sql.ast.tree.from.TableGroup; import org.hibernate.sql.ast.tree.predicate.Predicate; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java index 8b38b2516f..124831a646 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java @@ -18,6 +18,9 @@ import org.hibernate.sql.results.graph.FetchParent; import org.hibernate.sql.results.graph.basic.BasicFetch; /** + * @see jakarta.persistence.DiscriminatorColumn + * @see jakarta.persistence.DiscriminatorValue + * * @author Steve Ebersole */ public interface EntityDiscriminatorMapping extends VirtualModelPart, BasicValuedModelPart, FetchOptions { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java index ba9a85d161..74b9188a6a 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java @@ -47,9 +47,9 @@ import org.hibernate.type.descriptor.java.JavaType; import static org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer.UNFETCHED_PROPERTY; /** - * todo (6.0) : make this implement RootTableGroupProducer, etc instead of EntityPersister? + * Mapping of an entity * - * todo (6.0) : leverage the "relational model" here? + * @see jakarta.persistence.Entity * * @author Steve Ebersole */ diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityRowIdMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityRowIdMapping.java index c28b4b5558..39915952cf 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityRowIdMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityRowIdMapping.java @@ -6,6 +6,11 @@ */ package org.hibernate.metamodel.mapping; +/** + * Mapping of a row-id + * + * @see org.hibernate.annotations.RowId + */ public interface EntityRowIdMapping extends VirtualModelPart { String getRowIdName(); } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityValuedModelPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityValuedModelPart.java index 2dc4f01eec..a2f0ae0939 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityValuedModelPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityValuedModelPart.java @@ -20,6 +20,13 @@ import org.hibernate.sql.results.graph.DomainResultCreationState; import org.hibernate.sql.results.graph.FetchableContainer; /** + * Entity-valued model part + * * @author Steve Ebersole */ public interface EntityValuedModelPart extends FetchableContainer { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java index 0392f70647..71f20926ec 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdLogging.java @@ -12,6 +12,8 @@ import org.jboss.logging.Logger; /** * Logging related to natural-id operations + * + * @author Steve Ebersole */ public interface NaturalIdLogging { String LOGGER_NAME = CoreLogging.subsystemLoggerName( "mapping.natural_id" ); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdMapping.java index 1dd5909d39..ba5e831d66 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NaturalIdMapping.java @@ -15,6 +15,8 @@ import org.hibernate.loader.ast.spi.NaturalIdLoader; /** * Mapping for an entity's natural-id, if one is defined + * + * @author Steve Ebersole */ public interface NaturalIdMapping extends VirtualModelPart { String PART_NAME = "{natural-id}"; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NonAggregatedIdentifierMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NonAggregatedIdentifierMapping.java index 82e48ad232..a6fcebe28d 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NonAggregatedIdentifierMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/NonAggregatedIdentifierMapping.java @@ -26,6 +26,8 @@ import org.hibernate.sql.results.graph.embeddable.EmbeddableValuedFetchable; * * @see jakarta.persistence.IdClass * @see jakarta.persistence.MapsId + * + * @author Steve Ebersole */ public interface NonAggregatedIdentifierMapping extends CompositeIdentifierMapping, EmbeddableValuedFetchable, FetchOptions, VirtualModelPart { /** diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/PluralAttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/PluralAttributeMapping.java index 88aedb4a32..703062073f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/PluralAttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/PluralAttributeMapping.java @@ -24,6 +24,8 @@ import org.hibernate.sql.results.graph.Fetchable; import org.hibernate.sql.results.graph.FetchableContainer; /** + * Mapping of a plural (collection-valued) attribute + * * @author Steve Ebersole */ public interface PluralAttributeMapping diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java index 1cbd5c4612..39adeaf3a2 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/Queryable.java @@ -15,10 +15,6 @@ import org.hibernate.boot.spi.SessionFactoryOptions; * Defines a mapping model contract for things that can be queried in the HQL, * Criteria, etc sense. Generally this * - * todo (6.0) : consider whether collections are Queryable - * - depends how we envision Queryable being used. E.g. does it make - * sense to allow calls like `findSubPart( "index" )` or `findSubPart( "element" )`? - * * @author Steve Ebersole */ public interface Queryable extends ModelPart { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SingularAttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SingularAttributeMapping.java index 6d31507c37..2eecc664a6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SingularAttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SingularAttributeMapping.java @@ -7,6 +7,8 @@ package org.hibernate.metamodel.mapping; /** + * Mapping for a singular (non-collection) attribute. + * * @author Steve Ebersole */ public interface SingularAttributeMapping extends AttributeMapping, StateArrayContributorMapping { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SqlExpressible.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SqlExpressible.java index c18ffa4263..08678bff3f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SqlExpressible.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/SqlExpressible.java @@ -10,8 +10,6 @@ package org.hibernate.metamodel.mapping; * Unifying contract for things that are capable of being an expression in * the SQL AST. * - * todo (6.0) : consider adding `#toSqlExpression` returning a {@link org.hibernate.sql.ast.tree.expression.Expression} - * * @author Steve Ebersole */ public interface SqlExpressible extends JdbcMappingContainer { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/StateArrayContributorMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/StateArrayContributorMapping.java index 10706f7b05..d4e09204a4 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/StateArrayContributorMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/StateArrayContributorMapping.java @@ -9,6 +9,10 @@ package org.hibernate.metamodel.mapping; import org.hibernate.sql.results.graph.Fetchable; /** + * Describes a model-part which contributes state to the array of values + * for a container it is part of. For example, an attribute contributes + * a value to the state array for its declarer + * * @author Steve Ebersole */ public interface StateArrayContributorMapping extends AttributeMapping, Fetchable { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java index 90dc109fc4..7369de3171 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEmbeddableMapping.java @@ -86,7 +86,7 @@ public abstract class AbstractEmbeddableMapping implements EmbeddableMappingType final Object[] results = new Object[getNumberOfAttributeMappings()]; forEachAttributeMapping( (position, attribute) -> { final Getter getter = attribute.getAttributeMetadataAccess() - .resolveAttributeMetadata( null ) + .resolveAttributeMetadata( findContainingEntityMapping() ) .getPropertyAccess() .getGetter(); results[position] = getter.get( compositeInstance );