Search in sources :

Example 46 with AttributeMapping

use of org.hibernate.metamodel.mapping.AttributeMapping in project hibernate-orm by hibernate.

the class AbstractEmbeddableMapping method finishInitialization.

protected static boolean finishInitialization(NavigableRole navigableRole, Component bootDescriptor, CompositeType compositeType, String rootTableExpression, String[] rootTableKeyColumnNames, EmbeddableMappingType declarer, EmbeddableRepresentationStrategy representationStrategy, AttributeTypeValidator attributeTypeValidator, ConcreteTableResolver concreteTableResolver, Consumer<AttributeMapping> attributeConsumer, SuccessfulCompletionCallback completionCallback, MappingModelCreationProcess creationProcess) {
    final SessionFactoryImplementor sessionFactory = creationProcess.getCreationContext().getSessionFactory();
    final TypeConfiguration typeConfiguration = sessionFactory.getTypeConfiguration();
    final JdbcServices jdbcServices = sessionFactory.getJdbcServices();
    final JdbcEnvironment jdbcEnvironment = jdbcServices.getJdbcEnvironment();
    final Dialect dialect = jdbcEnvironment.getDialect();
    final Type[] subtypes = compositeType.getSubtypes();
    int attributeIndex = 0;
    int columnPosition = 0;
    for (Property bootPropertyDescriptor : bootDescriptor.getProperties()) {
        final Type subtype = subtypes[attributeIndex];
        attributeTypeValidator.check(bootPropertyDescriptor.getName(), subtype);
        final PropertyAccess propertyAccess = representationStrategy.resolvePropertyAccess(bootPropertyDescriptor);
        final AttributeMapping attributeMapping;
        if (subtype instanceof BasicType) {
            final BasicValue basicValue = (BasicValue) bootPropertyDescriptor.getValue();
            final Selectable selectable = basicValue.getColumn();
            final String containingTableExpression;
            final String columnExpression;
            if (rootTableKeyColumnNames == null) {
                if (selectable.isFormula()) {
                    columnExpression = selectable.getTemplate(dialect, creationProcess.getSqmFunctionRegistry());
                } else {
                    columnExpression = selectable.getText(dialect);
                }
                if (selectable instanceof Column) {
                    containingTableExpression = concreteTableResolver.resolve((Column) selectable, jdbcEnvironment);
                } else {
                    containingTableExpression = rootTableExpression;
                }
            } else {
                containingTableExpression = rootTableExpression;
                columnExpression = rootTableKeyColumnNames[columnPosition];
            }
            final String columnDefinition;
            final Long length;
            final Integer precision;
            final Integer scale;
            if (selectable instanceof Column) {
                Column column = (Column) selectable;
                columnDefinition = column.getSqlType();
                length = column.getLength();
                precision = column.getPrecision();
                scale = column.getScale();
            } else {
                columnDefinition = null;
                length = null;
                precision = null;
                scale = null;
            }
            attributeMapping = MappingModelCreationHelper.buildBasicAttributeMapping(bootPropertyDescriptor.getName(), navigableRole.append(bootPropertyDescriptor.getName()), attributeIndex, bootPropertyDescriptor, declarer, (BasicType<?>) subtype, containingTableExpression, columnExpression, selectable.isFormula(), selectable.getCustomReadExpression(), selectable.getCustomWriteExpression(), columnDefinition, length, precision, scale, propertyAccess, compositeType.getCascadeStyle(attributeIndex), creationProcess);
            columnPosition++;
        } else if (subtype instanceof AnyType) {
            final Any bootValueMapping = (Any) bootPropertyDescriptor.getValue();
            final AnyType anyType = (AnyType) subtype;
            final boolean nullable = bootValueMapping.isNullable();
            final boolean insertable = bootPropertyDescriptor.isInsertable();
            final boolean updateable = bootPropertyDescriptor.isUpdateable();
            final boolean includeInOptimisticLocking = bootPropertyDescriptor.isOptimisticLocked();
            final CascadeStyle cascadeStyle = compositeType.getCascadeStyle(attributeIndex);
            final MutabilityPlan<?> mutabilityPlan;
            if (updateable) {
                mutabilityPlan = new MutabilityPlan<>() {

                    @Override
                    public boolean isMutable() {
                        return true;
                    }

                    @Override
                    public Object deepCopy(Object value) {
                        if (value == null) {
                            return null;
                        }
                        return anyType.deepCopy(value, creationProcess.getCreationContext().getSessionFactory());
                    }

                    @Override
                    public Serializable disassemble(Object value, SharedSessionContract session) {
                        throw new NotYetImplementedFor6Exception(getClass());
                    }

                    @Override
                    public Object assemble(Serializable cached, SharedSessionContract session) {
                        throw new NotYetImplementedFor6Exception(getClass());
                    }
                };
            } else {
                mutabilityPlan = ImmutableMutabilityPlan.INSTANCE;
            }
            final StateArrayContributorMetadataAccess attributeMetadataAccess = entityMappingType -> new StateArrayContributorMetadata() {

                @Override
                public PropertyAccess getPropertyAccess() {
                    return propertyAccess;
                }

                @Override
                public MutabilityPlan<?> getMutabilityPlan() {
                    return mutabilityPlan;
                }

                @Override
                public boolean isNullable() {
                    return nullable;
                }

                @Override
                public boolean isInsertable() {
                    return insertable;
                }

                @Override
                public boolean isUpdatable() {
                    return updateable;
                }

                @Override
                public boolean isIncludedInDirtyChecking() {
                    // todo (6.0) : do not believe this is correct
                    return updateable;
                }

                @Override
                public boolean isIncludedInOptimisticLocking() {
                    return includeInOptimisticLocking;
                }

                @Override
                public CascadeStyle getCascadeStyle() {
                    return cascadeStyle;
                }
            };
            attributeMapping = new DiscriminatedAssociationAttributeMapping(navigableRole.append(bootPropertyDescriptor.getName()), typeConfiguration.getJavaTypeRegistry().getDescriptor(Object.class), declarer, attributeIndex, attributeMetadataAccess, bootPropertyDescriptor.isLazy() ? FetchTiming.DELAYED : FetchTiming.IMMEDIATE, propertyAccess, bootPropertyDescriptor, anyType, bootValueMapping, creationProcess);
        } else if (subtype instanceof CompositeType) {
            final CompositeType subCompositeType = (CompositeType) subtype;
            final int columnSpan = subCompositeType.getColumnSpan(sessionFactory);
            final String subTableExpression;
            final String[] subRootTableKeyColumnNames;
            if (rootTableKeyColumnNames == null) {
                subTableExpression = rootTableExpression;
                subRootTableKeyColumnNames = null;
            } else {
                subTableExpression = rootTableExpression;
                subRootTableKeyColumnNames = new String[columnSpan];
                System.arraycopy(rootTableKeyColumnNames, columnPosition, subRootTableKeyColumnNames, 0, columnSpan);
            }
            attributeMapping = MappingModelCreationHelper.buildEmbeddedAttributeMapping(bootPropertyDescriptor.getName(), attributeIndex, bootPropertyDescriptor, declarer, subCompositeType, subTableExpression, subRootTableKeyColumnNames, propertyAccess, compositeType.getCascadeStyle(attributeIndex), creationProcess);
            columnPosition += columnSpan;
        } else if (subtype instanceof CollectionType) {
            final EntityPersister entityPersister = creationProcess.getEntityPersister(bootDescriptor.getOwner().getEntityName());
            attributeMapping = MappingModelCreationHelper.buildPluralAttributeMapping(bootPropertyDescriptor.getName(), attributeIndex, bootPropertyDescriptor, entityPersister, propertyAccess, compositeType.getCascadeStyle(attributeIndex), compositeType.getFetchMode(attributeIndex), creationProcess);
        } else if (subtype instanceof EntityType) {
            final EntityPersister entityPersister = creationProcess.getEntityPersister(bootDescriptor.getOwner().getEntityName());
            attributeMapping = MappingModelCreationHelper.buildSingularAssociationAttributeMapping(bootPropertyDescriptor.getName(), navigableRole.append(bootPropertyDescriptor.getName()), attributeIndex, bootPropertyDescriptor, entityPersister, entityPersister, (EntityType) subtype, representationStrategy.resolvePropertyAccess(bootPropertyDescriptor), compositeType.getCascadeStyle(attributeIndex), creationProcess);
            columnPosition += bootPropertyDescriptor.getColumnSpan();
        } else {
            throw new MappingException(String.format(Locale.ROOT, "Unable to determine attribute nature : %s#%s", bootDescriptor.getOwner().getEntityName(), bootPropertyDescriptor.getName()));
        }
        attributeConsumer.accept(attributeMapping);
        attributeIndex++;
    }
    completionCallback.success();
    return true;
}
Also used : CascadeStyle(org.hibernate.engine.spi.CascadeStyle) EntityPersister(org.hibernate.persister.entity.EntityPersister) Serializable(java.io.Serializable) BasicType(org.hibernate.type.BasicType) SharedSessionContract(org.hibernate.SharedSessionContract) JdbcServices(org.hibernate.engine.jdbc.spi.JdbcServices) JdbcEnvironment(org.hibernate.engine.jdbc.env.spi.JdbcEnvironment) Any(org.hibernate.mapping.Any) BasicValue(org.hibernate.mapping.BasicValue) MappingException(org.hibernate.MappingException) Selectable(org.hibernate.mapping.Selectable) Column(org.hibernate.mapping.Column) CollectionType(org.hibernate.type.CollectionType) Dialect(org.hibernate.dialect.Dialect) MutabilityPlan(org.hibernate.type.descriptor.java.MutabilityPlan) ImmutableMutabilityPlan(org.hibernate.type.descriptor.java.ImmutableMutabilityPlan) Property(org.hibernate.mapping.Property) AnyType(org.hibernate.type.AnyType) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) StateArrayContributorMetadata(org.hibernate.metamodel.mapping.StateArrayContributorMetadata) PropertyAccess(org.hibernate.property.access.spi.PropertyAccess) EntityType(org.hibernate.type.EntityType) BasicType(org.hibernate.type.BasicType) AnyType(org.hibernate.type.AnyType) JavaType(org.hibernate.type.descriptor.java.JavaType) CollectionType(org.hibernate.type.CollectionType) EntityType(org.hibernate.type.EntityType) CompositeType(org.hibernate.type.CompositeType) EmbeddableMappingType(org.hibernate.metamodel.mapping.EmbeddableMappingType) Type(org.hibernate.type.Type) StateArrayContributorMetadataAccess(org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) NotYetImplementedFor6Exception(org.hibernate.NotYetImplementedFor6Exception) TypeConfiguration(org.hibernate.type.spi.TypeConfiguration) CompositeType(org.hibernate.type.CompositeType)

Example 47 with AttributeMapping

use of org.hibernate.metamodel.mapping.AttributeMapping in project hibernate-orm by hibernate.

the class AbstractEntityPersister method generateUpdateString.

/**
 * Generate the SQL that updates a row by id (and version)
 */
public String generateUpdateString(final boolean[] includeProperty, final int j, final Object[] oldFields, final boolean useRowId) {
    final Update update = createUpdate().setTableName(getTableName(j));
    boolean hasColumns = false;
    for (int index = 0; index < attributeMappings.size(); index++) {
        final AttributeMapping attributeMapping = attributeMappings.get(index);
        if (isPropertyOfTable(index, j)) {
            if (!lobProperties.contains(index)) {
                if (includeProperty[index]) {
                    update.addColumns(getPropertyColumnNames(index), propertyColumnUpdateable[index], propertyColumnWriters[index]);
                    hasColumns = true;
                } else {
                    final ValueGeneration valueGeneration = attributeMapping.getValueGeneration();
                    if (valueGeneration.getGenerationTiming().includesUpdate() && valueGeneration.getValueGenerator() == null && valueGeneration.referenceColumnInSql()) {
                        update.addColumns(getPropertyColumnNames(index), SINGLE_TRUE, new String[] { valueGeneration.getDatabaseGeneratedReferencedColumnValue() });
                        hasColumns = true;
                    }
                }
            }
        }
    }
    // and updates.  Insert them at the end.
    for (int i : lobProperties) {
        if (includeProperty[i] && isPropertyOfTable(i, j)) {
            // this property belongs on the table and is to be inserted
            update.addColumns(getPropertyColumnNames(i), propertyColumnUpdateable[i], propertyColumnWriters[i]);
            hasColumns = true;
        }
    }
    // select the correct row by either pk or row id
    if (useRowId) {
        // TODO: eventually, rowIdName[j]
        update.addPrimaryKeyColumns(new String[] { rowIdName });
    } else {
        update.addPrimaryKeyColumns(getKeyColumns(j));
    }
    if (j == 0 && isVersioned() && entityMetamodel.getOptimisticLockStyle().isVersion()) {
        // check it (unless this is a "generated" version column)!
        if (checkVersion(includeProperty)) {
            update.setVersionColumnName(getVersionColumnName());
            hasColumns = true;
        }
    } else if (isAllOrDirtyOptLocking() && oldFields != null) {
        // we are using "all" or "dirty" property-based optimistic locking
        boolean[] includeInWhere = entityMetamodel.getOptimisticLockStyle().isAll() ? // optimistic-lock="all", include all updatable properties
        getPropertyUpdateability() : // optimistic-lock="dirty", include all properties we are updating this time
        includeProperty;
        boolean[] versionability = getPropertyVersionability();
        Type[] types = getPropertyTypes();
        for (int i = 0; i < entityMetamodel.getPropertySpan(); i++) {
            boolean include = includeInWhere[i] && isPropertyOfTable(i, j) && versionability[i];
            if (include) {
                // this property belongs to the table, and it is not specifically
                // excluded from optimistic locking by optimistic-lock="false"
                String[] propertyColumnNames = getPropertyColumnNames(i);
                String[] propertyColumnWriters = getPropertyColumnWriters(i);
                boolean[] propertyNullness = types[i].toColumnNullness(oldFields[i], getFactory());
                for (int k = 0; k < propertyNullness.length; k++) {
                    if (propertyNullness[k]) {
                        update.addWhereColumn(propertyColumnNames[k], "=" + propertyColumnWriters[k]);
                    } else {
                        update.addWhereColumn(propertyColumnNames[k], " is null");
                    }
                }
            }
        }
    }
    if (getFactory().getSessionFactoryOptions().isCommentsEnabled()) {
        update.setComment("update " + getEntityName());
    }
    return hasColumns ? update.toStatementString() : null;
}
Also used : ValueGeneration(org.hibernate.tuple.ValueGeneration) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) DiscriminatedAssociationAttributeMapping(org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping) ToOneAttributeMapping(org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping) SingularAttributeMapping(org.hibernate.metamodel.mapping.SingularAttributeMapping) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) Update(org.hibernate.sql.Update)

Example 48 with AttributeMapping

use of org.hibernate.metamodel.mapping.AttributeMapping in project hibernate-orm by hibernate.

the class AbstractEntityPersister method generateNonIdAttributeMapping.

private AttributeMapping generateNonIdAttributeMapping(NonIdentifierAttribute tupleAttrDefinition, Property bootProperty, int stateArrayPosition, MappingModelCreationProcess creationProcess) {
    final SessionFactoryImplementor sessionFactory = creationProcess.getCreationContext().getSessionFactory();
    final JdbcServices jdbcServices = sessionFactory.getJdbcServices();
    final JdbcEnvironment jdbcEnvironment = jdbcServices.getJdbcEnvironment();
    final Dialect dialect = jdbcEnvironment.getDialect();
    final String attrName = tupleAttrDefinition.getName();
    final Type attrType = tupleAttrDefinition.getType();
    final int propertyIndex = getPropertyIndex(bootProperty.getName());
    final String tableExpression = getTableName(getPropertyTableNumbers()[propertyIndex]);
    final String[] attrColumnNames = getPropertyColumnNames(propertyIndex);
    final PropertyAccess propertyAccess = getRepresentationStrategy().resolvePropertyAccess(bootProperty);
    if (propertyIndex == getVersionProperty()) {
        Column column = bootProperty.getValue().getColumns().get(0);
        return MappingModelCreationHelper.buildBasicAttributeMapping(attrName, getNavigableRole().append(bootProperty.getName()), stateArrayPosition, bootProperty, this, (BasicType<?>) attrType, tableExpression, attrColumnNames[0], false, null, null, column.getSqlType(), column.getLength(), column.getPrecision(), column.getScale(), propertyAccess, tupleAttrDefinition.getCascadeStyle(), creationProcess);
    }
    if (attrType instanceof BasicType) {
        final Value bootValue = bootProperty.getValue();
        final String attrColumnExpression;
        final boolean isAttrColumnExpressionFormula;
        final String customReadExpr;
        final String customWriteExpr;
        final String columnDefinition;
        final Long length;
        final Integer precision;
        final Integer scale;
        if (bootValue instanceof DependantValue) {
            attrColumnExpression = attrColumnNames[0];
            isAttrColumnExpressionFormula = false;
            customReadExpr = null;
            customWriteExpr = null;
            Column column = bootValue.getColumns().get(0);
            columnDefinition = column.getSqlType();
            length = column.getLength();
            precision = column.getPrecision();
            scale = column.getScale();
        } else {
            final BasicValue basicBootValue = (BasicValue) bootValue;
            if (attrColumnNames[0] != null) {
                attrColumnExpression = attrColumnNames[0];
                isAttrColumnExpressionFormula = false;
                final List<Selectable> selectables = basicBootValue.getSelectables();
                assert !selectables.isEmpty();
                final Selectable selectable = selectables.get(0);
                assert attrColumnExpression.equals(selectable.getText(sessionFactory.getJdbcServices().getDialect()));
                customReadExpr = selectable.getTemplate(dialect, sessionFactory.getQueryEngine().getSqmFunctionRegistry());
                customWriteExpr = selectable.getCustomWriteExpression();
                Column column = bootValue.getColumns().get(0);
                columnDefinition = column.getSqlType();
                length = column.getLength();
                precision = column.getPrecision();
                scale = column.getScale();
            } else {
                final String[] attrColumnFormulaTemplate = propertyColumnFormulaTemplates[propertyIndex];
                attrColumnExpression = attrColumnFormulaTemplate[0];
                isAttrColumnExpressionFormula = true;
                customReadExpr = null;
                customWriteExpr = null;
                columnDefinition = null;
                length = null;
                precision = null;
                scale = null;
            }
        }
        return MappingModelCreationHelper.buildBasicAttributeMapping(attrName, getNavigableRole().append(bootProperty.getName()), stateArrayPosition, bootProperty, this, (BasicType<?>) attrType, tableExpression, attrColumnExpression, isAttrColumnExpressionFormula, customReadExpr, customWriteExpr, columnDefinition, length, precision, scale, propertyAccess, tupleAttrDefinition.getCascadeStyle(), creationProcess);
    } else if (attrType instanceof AnyType) {
        final JavaType<Object> baseAssociationJtd = sessionFactory.getTypeConfiguration().getJavaTypeRegistry().getDescriptor(Object.class);
        final AnyType anyType = (AnyType) attrType;
        return new DiscriminatedAssociationAttributeMapping(navigableRole.append(bootProperty.getName()), baseAssociationJtd, this, stateArrayPosition, entityMappingType -> new StateArrayContributorMetadata() {

            private final MutabilityPlan<?> mutabilityPlan = new DiscriminatedAssociationAttributeMapping.MutabilityPlanImpl(anyType);

            private final boolean nullable = bootProperty.isOptional();

            private final boolean insertable = bootProperty.isInsertable();

            private final boolean updateable = bootProperty.isUpdateable();

            private final boolean optimisticallyLocked = bootProperty.isOptimisticLocked();

            @Override
            public PropertyAccess getPropertyAccess() {
                return propertyAccess;
            }

            @Override
            public MutabilityPlan<?> getMutabilityPlan() {
                return mutabilityPlan;
            }

            @Override
            public boolean isNullable() {
                return nullable;
            }

            @Override
            public boolean isInsertable() {
                return insertable;
            }

            @Override
            public boolean isUpdatable() {
                return updateable;
            }

            @Override
            public boolean isIncludedInDirtyChecking() {
                return updateable;
            }

            @Override
            public boolean isIncludedInOptimisticLocking() {
                return optimisticallyLocked;
            }
        }, bootProperty.isLazy() ? FetchTiming.DELAYED : FetchTiming.IMMEDIATE, propertyAccess, bootProperty, (AnyType) attrType, (Any) bootProperty.getValue(), creationProcess);
    } else if (attrType instanceof CompositeType) {
        return MappingModelCreationHelper.buildEmbeddedAttributeMapping(attrName, stateArrayPosition, bootProperty, this, (CompositeType) attrType, tableExpression, null, propertyAccess, tupleAttrDefinition.getCascadeStyle(), creationProcess);
    } else if (attrType instanceof CollectionType) {
        return MappingModelCreationHelper.buildPluralAttributeMapping(attrName, stateArrayPosition, bootProperty, this, propertyAccess, tupleAttrDefinition.getCascadeStyle(), getFetchMode(stateArrayPosition), creationProcess);
    } else if (attrType instanceof EntityType) {
        return MappingModelCreationHelper.buildSingularAssociationAttributeMapping(attrName, getNavigableRole().append(attrName), stateArrayPosition, bootProperty, this, this, (EntityType) attrType, propertyAccess, tupleAttrDefinition.getCascadeStyle(), creationProcess);
    }
    return null;
}
Also used : Alias(org.hibernate.sql.Alias) Property(org.hibernate.mapping.Property) SqlFragmentPredicate(org.hibernate.persister.internal.SqlFragmentPredicate) BasicType(org.hibernate.type.BasicType) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType) ClassMetadata(org.hibernate.metadata.ClassMetadata) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) ReferenceCacheEntryImpl(org.hibernate.cache.spi.entry.ReferenceCacheEntryImpl) MappingModelCreationHelper(org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper) Expectations(org.hibernate.jdbc.Expectations) PostInsertIdentifierGenerator(org.hibernate.id.PostInsertIdentifierGenerator) Map(java.util.Map) EntityVersionMapping(org.hibernate.metamodel.mapping.EntityVersionMapping) SqlSelection(org.hibernate.sql.ast.spi.SqlSelection) IdentifierGenerator(org.hibernate.id.IdentifierGenerator) Optimizer(org.hibernate.id.enhanced.Optimizer) SingleIdEntityLoader(org.hibernate.loader.ast.spi.SingleIdEntityLoader) GeneratedValuesProcessor(org.hibernate.metamodel.mapping.internal.GeneratedValuesProcessor) NavigablePath(org.hibernate.query.spi.NavigablePath) LazyAttributeDescriptor(org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeDescriptor) Value(org.hibernate.mapping.Value) PreparedStatement(java.sql.PreparedStatement) SimpleFromClauseAccessImpl(org.hibernate.sql.ast.spi.SimpleFromClauseAccessImpl) Subclass(org.hibernate.mapping.Subclass) SqlAliasBase(org.hibernate.sql.ast.spi.SqlAliasBase) Serializable(java.io.Serializable) SqlExpressionResolver(org.hibernate.sql.ast.spi.SqlExpressionResolver) CacheHelper(org.hibernate.engine.internal.CacheHelper) SelectStatement(org.hibernate.sql.ast.tree.select.SelectStatement) PersisterCreationContext(org.hibernate.persister.spi.PersisterCreationContext) SqmMutationStrategyHelper(org.hibernate.query.sqm.mutation.internal.SqmMutationStrategyHelper) TooManyRowsAffectedException(org.hibernate.jdbc.TooManyRowsAffectedException) Dialect(org.hibernate.dialect.Dialect) CascadeStyle(org.hibernate.engine.spi.CascadeStyle) FetchMode(org.hibernate.FetchMode) UnstructuredCacheEntry(org.hibernate.cache.spi.entry.UnstructuredCacheEntry) CollectionPersister(org.hibernate.persister.collection.CollectionPersister) EnhancementHelper(org.hibernate.bytecode.enhance.spi.interceptor.EnhancementHelper) SelfDirtinessTracker(org.hibernate.engine.spi.SelfDirtinessTracker) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) SimpleNaturalIdMapping(org.hibernate.metamodel.mapping.internal.SimpleNaturalIdMapping) JdbcEnvironment(org.hibernate.engine.jdbc.env.spi.JdbcEnvironment) AssertionFailure(org.hibernate.AssertionFailure) SingleIdEntityLoaderDynamicBatch(org.hibernate.loader.ast.internal.SingleIdEntityLoaderDynamicBatch) FilterHelper(org.hibernate.internal.FilterHelper) QueryOptions(org.hibernate.query.spi.QueryOptions) Session(org.hibernate.Session) SessionFactoryOptions(org.hibernate.boot.spi.SessionFactoryOptions) EntityDataAccess(org.hibernate.cache.spi.access.EntityDataAccess) Metadata(org.hibernate.boot.Metadata) Supplier(java.util.function.Supplier) NaturalIdResolutions(org.hibernate.engine.spi.NaturalIdResolutions) SemanticException(org.hibernate.query.SemanticException) EntityVersionMappingImpl(org.hibernate.metamodel.mapping.internal.EntityVersionMappingImpl) LinkedHashMap(java.util.LinkedHashMap) NamedTableReference(org.hibernate.sql.ast.tree.from.NamedTableReference) MultiIdLoadOptions(org.hibernate.loader.ast.spi.MultiIdLoadOptions) Preparable(org.hibernate.loader.ast.internal.Preparable) DiscriminatedAssociationAttributeMapping(org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping) ToOneAttributeMapping(org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping) StandardTableGroup(org.hibernate.sql.ast.tree.from.StandardTableGroup) InFlightEntityMappingType(org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType) LoaderSelectBuilder(org.hibernate.loader.ast.internal.LoaderSelectBuilder) LazyAttributesMetadata(org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributesMetadata) SimpleSelect(org.hibernate.sql.SimpleSelect) EntityDiscriminatorMapping(org.hibernate.metamodel.mapping.EntityDiscriminatorMapping) JdbcServices(org.hibernate.engine.jdbc.spi.JdbcServices) EntityKey(org.hibernate.engine.spi.EntityKey) Table(org.hibernate.mapping.Table) Fetch(org.hibernate.sql.results.graph.Fetch) NaturalIdLoader(org.hibernate.loader.ast.spi.NaturalIdLoader) QueryableCollection(org.hibernate.persister.collection.QueryableCollection) Template(org.hibernate.sql.Template) FromClauseAccess(org.hibernate.sql.ast.spi.FromClauseAccess) TreeMap(java.util.TreeMap) BytecodeLazyAttributeInterceptor(org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor) NaturalIdMapping(org.hibernate.metamodel.mapping.NaturalIdMapping) SqlSelectionImpl(org.hibernate.sql.results.internal.SqlSelectionImpl) CachedNaturalIdValueSource(org.hibernate.engine.spi.CachedNaturalIdValueSource) AssociationType(org.hibernate.type.AssociationType) TableGroup(org.hibernate.sql.ast.tree.from.TableGroup) AnyType(org.hibernate.type.AnyType) EntityResultImpl(org.hibernate.sql.results.graph.entity.internal.EntityResultImpl) SingleIdEntityLoaderStandardImpl(org.hibernate.loader.ast.internal.SingleIdEntityLoaderStandardImpl) PersistentCollection(org.hibernate.collection.spi.PersistentCollection) LockModeEnumMap(org.hibernate.internal.util.collections.LockModeEnumMap) Locale(java.util.Locale) Binder(org.hibernate.id.insert.Binder) ComparisonOperator(org.hibernate.query.sqm.ComparisonOperator) LazyPropertyInitializer(org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer) PersistentAttributeInterceptable(org.hibernate.engine.spi.PersistentAttributeInterceptable) Formula(org.hibernate.mapping.Formula) Collection(java.util.Collection) StaleObjectStateException(org.hibernate.StaleObjectStateException) Column(org.hibernate.mapping.Column) StatisticsImplementor(org.hibernate.stat.spi.StatisticsImplementor) BasicBatchKey(org.hibernate.engine.jdbc.batch.internal.BasicBatchKey) Objects(java.util.Objects) ArrayHelper(org.hibernate.internal.util.collections.ArrayHelper) EntityRowIdMappingImpl(org.hibernate.metamodel.mapping.internal.EntityRowIdMappingImpl) Queryable(org.hibernate.metamodel.mapping.Queryable) Update(org.hibernate.sql.Update) LoaderSqlAstCreationState(org.hibernate.loader.ast.internal.LoaderSqlAstCreationState) SelectableConsumer(org.hibernate.metamodel.mapping.SelectableConsumer) IndexedConsumer(org.hibernate.mapping.IndexedConsumer) DomainResultCreationState(org.hibernate.sql.results.graph.DomainResultCreationState) OptimisticLockStyle(org.hibernate.engine.OptimisticLockStyle) CacheEntityLoaderHelper(org.hibernate.loader.entity.CacheEntityLoaderHelper) JdbcMapping(org.hibernate.metamodel.mapping.JdbcMapping) RootClass(org.hibernate.mapping.RootClass) OptimizableGenerator(org.hibernate.id.OptimizableGenerator) TableReference(org.hibernate.sql.ast.tree.from.TableReference) HashSet(java.util.HashSet) ModelPart(org.hibernate.metamodel.mapping.ModelPart) Loader(org.hibernate.loader.ast.spi.Loader) CompositeType(org.hibernate.type.CompositeType) ManagedMappingType(org.hibernate.metamodel.mapping.ManagedMappingType) LockingStrategy(org.hibernate.dialect.lock.LockingStrategy) DiscriminatedAssociationModelPart(org.hibernate.metamodel.mapping.DiscriminatedAssociationModelPart) SqlAliasBaseManager(org.hibernate.sql.ast.spi.SqlAliasBaseManager) InsertGeneratedIdentifierDelegate(org.hibernate.id.insert.InsertGeneratedIdentifierDelegate) EntityEntryFactory(org.hibernate.engine.spi.EntityEntryFactory) SqmFunctionRegistry(org.hibernate.query.sqm.function.SqmFunctionRegistry) EntityMetamodel(org.hibernate.tuple.entity.EntityMetamodel) MappingModelCreationProcess(org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess) Consumer(java.util.function.Consumer) EntityRepresentationStrategy(org.hibernate.metamodel.spi.EntityRepresentationStrategy) JdbcParameter(org.hibernate.sql.ast.tree.expression.JdbcParameter) SelectableMapping(org.hibernate.metamodel.mapping.SelectableMapping) Selectable(org.hibernate.mapping.Selectable) NonAggregatedIdentifierMapping(org.hibernate.metamodel.mapping.NonAggregatedIdentifierMapping) EntityEntry(org.hibernate.engine.spi.EntityEntry) BitSet(java.util.BitSet) Comparator(java.util.Comparator) MutableEntityEntryFactory(org.hibernate.engine.internal.MutableEntityEntryFactory) MultiIdLoaderStandard(org.hibernate.loader.ast.internal.MultiIdLoaderStandard) Arrays(java.util.Arrays) EventSource(org.hibernate.event.spi.EventSource) ReflectionOptimizer(org.hibernate.bytecode.spi.ReflectionOptimizer) PersistenceContext(org.hibernate.engine.spi.PersistenceContext) PropertyAccess(org.hibernate.property.access.spi.PropertyAccess) SingleUniqueKeyEntityLoaderStandard(org.hibernate.loader.ast.internal.SingleUniqueKeyEntityLoaderStandard) ForeignKeyDescriptor(org.hibernate.metamodel.mapping.ForeignKeyDescriptor) PersistentClass(org.hibernate.mapping.PersistentClass) ResultSet(java.sql.ResultSet) MultiIdEntityLoader(org.hibernate.loader.ast.spi.MultiIdEntityLoader) LazyAttributeLoadingInterceptor(org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor) Insert(org.hibernate.sql.Insert) StaleStateException(org.hibernate.StaleStateException) SingleUniqueKeyEntityLoader(org.hibernate.loader.ast.spi.SingleUniqueKeyEntityLoader) BytecodeEnhancementMetadata(org.hibernate.bytecode.spi.BytecodeEnhancementMetadata) Fetchable(org.hibernate.sql.results.graph.Fetchable) StructuredCacheEntry(org.hibernate.cache.spi.entry.StructuredCacheEntry) LockOptions(org.hibernate.LockOptions) ImmutableEntityEntryFactory(org.hibernate.engine.internal.ImmutableEntityEntryFactory) StringHelper(org.hibernate.internal.util.StringHelper) Set(java.util.Set) Expression(org.hibernate.sql.ast.tree.expression.Expression) SingleIdArrayLoadPlan(org.hibernate.loader.ast.internal.SingleIdArrayLoadPlan) Assigned(org.hibernate.id.Assigned) LazyValue(org.hibernate.internal.util.LazyValue) EntityIdentifierMapping(org.hibernate.metamodel.mapping.EntityIdentifierMapping) BasicEntityIdentifierMappingImpl(org.hibernate.metamodel.mapping.internal.BasicEntityIdentifierMappingImpl) Expectation(org.hibernate.jdbc.Expectation) RuntimeModelCreationContext(org.hibernate.metamodel.spi.RuntimeModelCreationContext) EnhancementAsProxyLazinessInterceptor(org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor) HibernateException(org.hibernate.HibernateException) CacheEntryStructure(org.hibernate.cache.spi.entry.CacheEntryStructure) QueryException(org.hibernate.QueryException) StateArrayContributorMapping(org.hibernate.metamodel.mapping.StateArrayContributorMapping) MutabilityPlan(org.hibernate.type.descriptor.java.MutabilityPlan) JavaType(org.hibernate.type.descriptor.java.JavaType) Setter(org.hibernate.property.access.spi.Setter) Clause(org.hibernate.sql.ast.Clause) ArrayList(java.util.ArrayList) StandardCacheEntryImpl(org.hibernate.cache.spi.entry.StandardCacheEntryImpl) ValueGeneration(org.hibernate.tuple.ValueGeneration) SQLException(java.sql.SQLException) BiConsumer(java.util.function.BiConsumer) PostInsertIdentityPersister(org.hibernate.id.PostInsertIdentityPersister) FetchTiming(org.hibernate.engine.FetchTiming) BulkInsertionCapableIdentifierGenerator(org.hibernate.id.BulkInsertionCapableIdentifierGenerator) SingularAttributeMapping(org.hibernate.metamodel.mapping.SingularAttributeMapping) Delete(org.hibernate.sql.Delete) StatefulPersistenceContext(org.hibernate.engine.internal.StatefulPersistenceContext) CompoundNaturalIdMapping(org.hibernate.metamodel.mapping.internal.CompoundNaturalIdMapping) LoadEvent(org.hibernate.event.spi.LoadEvent) MultiNaturalIdLoader(org.hibernate.loader.ast.spi.MultiNaturalIdLoader) CollectionHelper(org.hibernate.internal.util.collections.CollectionHelper) NamedQueryMemento(org.hibernate.query.named.NamedQueryMemento) SqmMultiTableMutationStrategy(org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy) Filter(org.hibernate.Filter) SQLQueryParser(org.hibernate.query.sql.internal.SQLQueryParser) Lifecycle(org.hibernate.classic.Lifecycle) MessageHelper(org.hibernate.pretty.MessageHelper) Any(org.hibernate.mapping.Any) EntityBasedAssociationAttribute(org.hibernate.tuple.entity.EntityBasedAssociationAttribute) MappingModelHelper(org.hibernate.metamodel.mapping.MappingModelHelper) SqlAstCreationContext(org.hibernate.sql.ast.spi.SqlAstCreationContext) NonIdentifierAttribute(org.hibernate.tuple.NonIdentifierAttribute) ComparisonPredicate(org.hibernate.sql.ast.tree.predicate.ComparisonPredicate) JDBCException(org.hibernate.JDBCException) PersistentAttributeInterceptor(org.hibernate.engine.spi.PersistentAttributeInterceptor) ExecuteUpdateResultCheckStyle(org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle) TableReferenceJoin(org.hibernate.sql.ast.tree.from.TableReferenceJoin) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) CacheEntry(org.hibernate.cache.spi.entry.CacheEntry) AttributeMetadataAccess(org.hibernate.metamodel.mapping.AttributeMetadataAccess) IdentityHashMap(java.util.IdentityHashMap) DependantValue(org.hibernate.mapping.DependantValue) VirtualModelPart(org.hibernate.metamodel.mapping.VirtualModelPart) DomainResult(org.hibernate.sql.results.graph.DomainResult) SqmMultiTableInsertStrategy(org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy) NavigableRole(org.hibernate.metamodel.model.domain.NavigableRole) LoadQueryInfluencers(org.hibernate.engine.spi.LoadQueryInfluencers) List(java.util.List) EntityInstantiator(org.hibernate.metamodel.spi.EntityInstantiator) SingleIdEntityLoaderProvidedQueryImpl(org.hibernate.loader.ast.internal.SingleIdEntityLoaderProvidedQueryImpl) MappingException(org.hibernate.MappingException) BasicValue(org.hibernate.mapping.BasicValue) SessionImplementor(org.hibernate.engine.spi.SessionImplementor) QuerySpec(org.hibernate.sql.ast.tree.select.QuerySpec) SortedMap(java.util.SortedMap) SharedSessionContractImplementor(org.hibernate.engine.spi.SharedSessionContractImplementor) BasicValuedModelPart(org.hibernate.metamodel.mapping.BasicValuedModelPart) CoreMessageLogger(org.hibernate.internal.CoreMessageLogger) Junction(org.hibernate.sql.ast.tree.predicate.Junction) InDatabaseValueGenerationStrategy(org.hibernate.tuple.InDatabaseValueGenerationStrategy) ColumnReference(org.hibernate.sql.ast.tree.expression.ColumnReference) CollectionType(org.hibernate.type.CollectionType) HashMap(java.util.HashMap) SqlAliasStemHelper(org.hibernate.sql.ast.spi.SqlAliasStemHelper) InMemoryValueGenerationStrategy(org.hibernate.tuple.InMemoryValueGenerationStrategy) EntityType(org.hibernate.type.EntityType) RepresentationMode(org.hibernate.metamodel.RepresentationMode) FilterAliasGenerator(org.hibernate.internal.FilterAliasGenerator) AttributeMetadata(org.hibernate.metamodel.mapping.AttributeMetadata) SqlAliasBaseConstant(org.hibernate.sql.ast.spi.SqlAliasBaseConstant) SqlAstCreationState(org.hibernate.sql.ast.spi.SqlAstCreationState) LockMode(org.hibernate.LockMode) Predicate(org.hibernate.sql.ast.tree.predicate.Predicate) Versioning(org.hibernate.engine.internal.Versioning) AliasedExpression(org.hibernate.sql.ast.tree.expression.AliasedExpression) ExplicitColumnDiscriminatorMappingImpl(org.hibernate.metamodel.mapping.internal.ExplicitColumnDiscriminatorMappingImpl) SelectClause(org.hibernate.sql.ast.tree.select.SelectClause) Association(org.hibernate.metamodel.mapping.Association) EntityRowIdMapping(org.hibernate.metamodel.mapping.EntityRowIdMapping) GenerationTiming(org.hibernate.tuple.GenerationTiming) Component(org.hibernate.mapping.Component) CollectionKey(org.hibernate.engine.spi.CollectionKey) StateArrayContributorMetadata(org.hibernate.metamodel.mapping.StateArrayContributorMetadata) LazyInitializationException(org.hibernate.LazyInitializationException) EmbeddableValuedModelPart(org.hibernate.metamodel.mapping.EmbeddableValuedModelPart) NaturalIdDataAccess(org.hibernate.cache.spi.access.NaturalIdDataAccess) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) Collections(java.util.Collections) CoreLogging(org.hibernate.internal.CoreLogging) Type(org.hibernate.type.Type) BasicType(org.hibernate.type.BasicType) DiscriminatedAssociationAttributeMapping(org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping) JdbcServices(org.hibernate.engine.jdbc.spi.JdbcServices) JdbcEnvironment(org.hibernate.engine.jdbc.env.spi.JdbcEnvironment) Any(org.hibernate.mapping.Any) BasicValue(org.hibernate.mapping.BasicValue) Column(org.hibernate.mapping.Column) Selectable(org.hibernate.mapping.Selectable) CollectionType(org.hibernate.type.CollectionType) Dialect(org.hibernate.dialect.Dialect) MutabilityPlan(org.hibernate.type.descriptor.java.MutabilityPlan) AnyType(org.hibernate.type.AnyType) DependantValue(org.hibernate.mapping.DependantValue) SessionFactoryImplementor(org.hibernate.engine.spi.SessionFactoryImplementor) StateArrayContributorMetadata(org.hibernate.metamodel.mapping.StateArrayContributorMetadata) PropertyAccess(org.hibernate.property.access.spi.PropertyAccess) EntityType(org.hibernate.type.EntityType) BasicType(org.hibernate.type.BasicType) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType) InFlightEntityMappingType(org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType) AssociationType(org.hibernate.type.AssociationType) AnyType(org.hibernate.type.AnyType) CompositeType(org.hibernate.type.CompositeType) ManagedMappingType(org.hibernate.metamodel.mapping.ManagedMappingType) JavaType(org.hibernate.type.descriptor.java.JavaType) CollectionType(org.hibernate.type.CollectionType) EntityType(org.hibernate.type.EntityType) Type(org.hibernate.type.Type) JavaType(org.hibernate.type.descriptor.java.JavaType) Value(org.hibernate.mapping.Value) LazyValue(org.hibernate.internal.util.LazyValue) DependantValue(org.hibernate.mapping.DependantValue) BasicValue(org.hibernate.mapping.BasicValue) CompositeType(org.hibernate.type.CompositeType)

Example 49 with AttributeMapping

use of org.hibernate.metamodel.mapping.AttributeMapping in project hibernate-orm by hibernate.

the class AbstractEntityPersister method resolveAttributeIndexes.

@Override
public int[] resolveAttributeIndexes(String[] attributeNames) {
    if (attributeNames == null || attributeNames.length == 0) {
        return ArrayHelper.EMPTY_INT_ARRAY;
    }
    final List<Integer> fields = new ArrayList<>(attributeNames.length);
    // Sort attribute names so that we can traverse mappings efficiently
    Arrays.sort(attributeNames);
    int index = 0;
    for (final AttributeMapping attributeMapping : attributeMappings) {
        final String attributeName = attributeMapping.getAttributeName();
        final int nameLength = attributeName.length();
        final String currentAttributeName = attributeNames[index];
        if (currentAttributeName.startsWith(attributeName) && ((currentAttributeName.length() == nameLength || currentAttributeName.charAt(nameLength) == '.'))) {
            fields.add(((StateArrayContributorMapping) attributeMapping).getStateArrayPosition());
            index++;
            if (index < attributeNames.length) {
                // Skip duplicates
                do {
                    if (attributeNames[index].equals(attributeMapping.getAttributeName())) {
                        index++;
                    } else {
                        break;
                    }
                } while (index < attributeNames.length);
            } else {
                break;
            }
        }
    }
    return ArrayHelper.toIntArray(fields);
}
Also used : PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) DiscriminatedAssociationAttributeMapping(org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping) ToOneAttributeMapping(org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping) SingularAttributeMapping(org.hibernate.metamodel.mapping.SingularAttributeMapping) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) ArrayList(java.util.ArrayList)

Example 50 with AttributeMapping

use of org.hibernate.metamodel.mapping.AttributeMapping in project hibernate-orm by hibernate.

the class AbstractEntityPersister method findSubPart.

@Override
public ModelPart findSubPart(String name, EntityMappingType treatTargetType) {
    LOG.tracef("#findSubPart(`%s`)", name);
    if (EntityDiscriminatorMapping.matchesRoleName(name)) {
        return discriminatorMapping;
    }
    final AttributeMapping declaredAttribute = declaredAttributeMappings.get(name);
    if (declaredAttribute != null) {
        return declaredAttribute;
    }
    if (superMappingType != null) {
        final ModelPart superDefinedAttribute = superMappingType.findSubPart(name, superMappingType);
        if (superDefinedAttribute != null) {
            // Prefer the identifier mapping of the concrete class
            if (superDefinedAttribute instanceof EntityIdentifierMapping) {
                final ModelPart identifierModelPart = getIdentifierModelPart(name, treatTargetType);
                if (identifierModelPart != null) {
                    return identifierModelPart;
                }
            }
            return superDefinedAttribute;
        }
    }
    if (treatTargetType != null) {
        if (!treatTargetType.isTypeOrSuperType(this)) {
            return null;
        }
        if (subclassMappingTypes != null && !subclassMappingTypes.isEmpty()) {
            for (EntityMappingType subMappingType : subclassMappingTypes.values()) {
                if (!treatTargetType.isTypeOrSuperType(subMappingType)) {
                    continue;
                }
                final ModelPart subDefinedAttribute = subMappingType.findSubTypesSubPart(name, treatTargetType);
                if (subDefinedAttribute != null) {
                    return subDefinedAttribute;
                }
            }
        }
    } else {
        if (subclassMappingTypes != null && !subclassMappingTypes.isEmpty()) {
            ModelPart attribute = null;
            for (EntityMappingType subMappingType : subclassMappingTypes.values()) {
                final ModelPart subDefinedAttribute = subMappingType.findSubTypesSubPart(name, treatTargetType);
                if (subDefinedAttribute != null) {
                    if (attribute != null && !MappingModelHelper.isCompatibleModelPart(attribute, subDefinedAttribute)) {
                        throw new IllegalArgumentException(new SemanticException(String.format(Locale.ROOT, "Could not resolve attribute '%s' of '%s' due to the attribute being declared in multiple sub types: ['%s', '%s']", name, getJavaType().getJavaType().getTypeName(), ((AttributeMapping) attribute).getDeclaringType().getJavaType().getJavaType().getTypeName(), ((AttributeMapping) subDefinedAttribute).getDeclaringType().getJavaType().getJavaType().getTypeName())));
                    }
                    attribute = subDefinedAttribute;
                }
            }
            if (attribute != null) {
                return attribute;
            }
        }
    }
    final ModelPart identifierModelPart = getIdentifierModelPart(name, treatTargetType);
    if (identifierModelPart != null) {
        return identifierModelPart;
    }
    for (AttributeMapping attribute : declaredAttributeMappings.values()) {
        if (attribute instanceof EmbeddableValuedModelPart && attribute instanceof VirtualModelPart) {
            final ModelPart subPart = ((EmbeddableValuedModelPart) attribute).findSubPart(name, null);
            if (subPart != null) {
                return subPart;
            }
        }
    }
    return null;
}
Also used : ModelPart(org.hibernate.metamodel.mapping.ModelPart) DiscriminatedAssociationModelPart(org.hibernate.metamodel.mapping.DiscriminatedAssociationModelPart) VirtualModelPart(org.hibernate.metamodel.mapping.VirtualModelPart) BasicValuedModelPart(org.hibernate.metamodel.mapping.BasicValuedModelPart) EmbeddableValuedModelPart(org.hibernate.metamodel.mapping.EmbeddableValuedModelPart) PluralAttributeMapping(org.hibernate.metamodel.mapping.PluralAttributeMapping) EmbeddedAttributeMapping(org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping) DiscriminatedAssociationAttributeMapping(org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping) ToOneAttributeMapping(org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping) SingularAttributeMapping(org.hibernate.metamodel.mapping.SingularAttributeMapping) AttributeMapping(org.hibernate.metamodel.mapping.AttributeMapping) EntityIdentifierMapping(org.hibernate.metamodel.mapping.EntityIdentifierMapping) EmbeddableValuedModelPart(org.hibernate.metamodel.mapping.EmbeddableValuedModelPart) EntityMappingType(org.hibernate.metamodel.mapping.EntityMappingType) InFlightEntityMappingType(org.hibernate.metamodel.mapping.internal.InFlightEntityMappingType) SemanticException(org.hibernate.query.SemanticException) VirtualModelPart(org.hibernate.metamodel.mapping.VirtualModelPart)

Aggregations

AttributeMapping (org.hibernate.metamodel.mapping.AttributeMapping)56 PluralAttributeMapping (org.hibernate.metamodel.mapping.PluralAttributeMapping)38 SingularAttributeMapping (org.hibernate.metamodel.mapping.SingularAttributeMapping)20 EmbeddedAttributeMapping (org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping)19 ToOneAttributeMapping (org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping)19 EntityPersister (org.hibernate.persister.entity.EntityPersister)17 SessionFactoryImplementor (org.hibernate.engine.spi.SessionFactoryImplementor)13 EntityIdentifierMapping (org.hibernate.metamodel.mapping.EntityIdentifierMapping)12 DiscriminatedAssociationAttributeMapping (org.hibernate.metamodel.mapping.internal.DiscriminatedAssociationAttributeMapping)12 EntityMappingType (org.hibernate.metamodel.mapping.EntityMappingType)10 Test (org.junit.jupiter.api.Test)9 ArrayList (java.util.ArrayList)8 EmbeddableMappingType (org.hibernate.metamodel.mapping.EmbeddableMappingType)8 ModelPart (org.hibernate.metamodel.mapping.ModelPart)7 Expression (org.hibernate.sql.ast.tree.expression.Expression)7 ForeignKeyDescriptor (org.hibernate.metamodel.mapping.ForeignKeyDescriptor)6 NonAggregatedIdentifierMapping (org.hibernate.metamodel.mapping.NonAggregatedIdentifierMapping)6 Fetchable (org.hibernate.sql.results.graph.Fetchable)6 CascadeStyle (org.hibernate.engine.spi.CascadeStyle)5 NavigablePath (org.hibernate.query.spi.NavigablePath)5