api, spi, internal, deprecation, java

This commit is contained in:
Steve Ebersole 2022-01-24 14:58:25 -06:00
parent 4c0824d74d
commit 7f2194e068
55 changed files with 155 additions and 97 deletions

View File

@ -21,5 +21,5 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target( {TYPE, FIELD, METHOD, ANNOTATION_TYPE} )
@Retention( RUNTIME )
public @interface EmbeddableInstantiator {
Class<? extends org.hibernate.metamodel.EmbeddableInstantiator> value();
Class<? extends org.hibernate.metamodel.spi.EmbeddableInstantiator> value();
}

View File

@ -10,7 +10,7 @@ import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.PACKAGE;

View File

@ -99,7 +99,7 @@ import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.UniqueKey;
import org.hibernate.metamodel.CollectionClassification;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.query.named.NamedObjectRepository;
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -23,7 +23,6 @@ import org.hibernate.boot.internal.NamedProcedureCallDefinitionImpl;
import org.hibernate.boot.model.IdentifierGeneratorDefinition;
import org.hibernate.boot.model.TypeDefinition;
import org.hibernate.boot.model.TypeDefinitionRegistry;
import org.hibernate.boot.model.convert.internal.InstanceBasedConverterDescriptor;
import org.hibernate.boot.model.convert.spi.ConverterAutoApplyHandler;
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
import org.hibernate.boot.model.naming.Identifier;
@ -35,7 +34,6 @@ import org.hibernate.boot.query.NamedNativeQueryDefinition;
import org.hibernate.boot.query.NamedProcedureCallDefinition;
import org.hibernate.boot.query.NamedResultSetMappingDescriptor;
import org.hibernate.cfg.AnnotatedClassType;
import org.hibernate.cfg.AttributeConverterDefinition;
import org.hibernate.cfg.JPAIndexHolder;
import org.hibernate.cfg.PropertyData;
import org.hibernate.cfg.SecondPass;
@ -52,7 +50,7 @@ import org.hibernate.mapping.MappedSuperclass;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Table;
import org.hibernate.metamodel.CollectionClassification;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.jdbc.JdbcType;
import org.hibernate.usertype.UserCollectionType;

View File

@ -138,7 +138,7 @@ import org.hibernate.mapping.SingleTableSubclass;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.UnionSubclass;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;

View File

@ -105,7 +105,7 @@ import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.Table;
import org.hibernate.metamodel.CollectionClassification;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.usertype.ParameterizedType;

View File

@ -39,7 +39,7 @@ import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.mapping.ToOne;
import org.hibernate.mapping.Value;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.tuple.AnnotationValueGeneration;
import org.hibernate.tuple.AttributeBinder;
import org.hibernate.tuple.GenerationTiming;

View File

@ -46,7 +46,6 @@ import org.hibernate.engine.internal.NonNullableTransientDependencies;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.proxy.LazyInitializer;
import org.hibernate.type.CollectionType;
@ -1256,27 +1255,24 @@ public class ActionQueue {
* @param batchIdentifier The batch identifier of the entity affected by the action
*/
private void addParentChildEntityNames(AbstractEntityInsertAction action, BatchIdentifier batchIdentifier) {
Object[] propertyValues = action.getState();
ClassMetadata classMetadata = action.getPersister().getClassMetadata();
if ( classMetadata != null ) {
Type[] propertyTypes = classMetadata.getPropertyTypes();
Type identifierType = classMetadata.getIdentifierType();
final Object[] propertyValues = action.getState();
final Type[] propertyTypes = action.getPersister().getPropertyTypes();
final Type identifierType = action.getPersister().getIdentifierType();
for ( int i = 0; i < propertyValues.length; i++ ) {
Object value = propertyValues[i];
if ( value != null ) {
Type type = propertyTypes[i];
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, value );
}
for ( int i = 0; i < propertyValues.length; i++ ) {
Object value = propertyValues[i];
if ( value != null ) {
Type type = propertyTypes[i];
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, value );
}
}
if ( identifierType.isComponentType() ) {
CompositeType compositeType = (CompositeType) identifierType;
Type[] compositeIdentifierTypes = compositeType.getSubtypes();
if ( identifierType.isComponentType() ) {
CompositeType compositeType = (CompositeType) identifierType;
Type[] compositeIdentifierTypes = compositeType.getSubtypes();
for ( Type type : compositeIdentifierTypes ) {
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, null );
}
for ( Type type : compositeIdentifierTypes ) {
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, null );
}
}
}

View File

@ -25,6 +25,7 @@ import org.hibernate.engine.spi.PersistenceContext;
import org.hibernate.engine.spi.PersistentAttributeInterceptable;
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
import org.hibernate.engine.spi.SelfDirtinessTracker;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.Status;
import org.hibernate.event.spi.EventSource;
@ -35,7 +36,8 @@ import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.jpa.event.spi.CallbackRegistry;
import org.hibernate.jpa.event.spi.CallbackRegistryConsumer;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metamodel.RuntimeMetamodels;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.NaturalIdMapping;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.pretty.MessageHelper;
@ -354,8 +356,11 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
private boolean copyState(Object entity, Type[] types, Object[] state, SessionFactory sf) {
// copy the entity state into the state array and return true if the state has changed
ClassMetadata metadata = sf.getClassMetadata( entity.getClass() );
Object[] newState = metadata.getPropertyValues( entity );
final SessionFactoryImplementor sessionFactory = sf.unwrap( SessionFactoryImplementor.class );
final RuntimeMetamodels runtimeMetamodels = sessionFactory.getRuntimeMetamodels();
final EntityMappingType entityMappingType = runtimeMetamodels.getEntityMappingType( entity.getClass() );
final Object[] newState = entityMappingType.getEntityPersister().getValues( entity );
int size = newState.length;
boolean isDirty = false;
for ( int index = 0; index < size; index++ ) {

View File

@ -7,12 +7,13 @@
package org.hibernate.loader;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.spi.DotIdentifierSequence;
import org.hibernate.query.spi.NavigablePath;
/**
* @author Steve Ebersole
*/
public class PropertyPath {
public class PropertyPath implements DotIdentifierSequence {
public static final String IDENTIFIER_MAPPER_PROPERTY = NavigablePath.IDENTIFIER_MAPPER_PROPERTY;
@ -65,6 +66,11 @@ public class PropertyPath {
return parent;
}
@Override
public String getLocalName() {
return property;
}
public String getProperty() {
return property;
}

View File

@ -27,7 +27,7 @@ import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.collections.JoinedIterator;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.property.access.spi.Setter;
import org.hibernate.type.ComponentType;
import org.hibernate.type.EmbeddedComponentType;

View File

@ -6,16 +6,57 @@
*/
package org.hibernate.metamodel;
import org.hibernate.Incubating;
import jakarta.persistence.metamodel.Attribute.PersistentAttributeType;
/**
* An extended set of {@link PersistentAttributeType} adding {@link #ANY}
*
* @since 6.0
*
*/
@Incubating
public enum AttributeClassification {
/**
* @see jakarta.persistence.Basic
*/
BASIC( PersistentAttributeType.BASIC ),
/**
* @see jakarta.persistence.Embedded
*/
EMBEDDED( PersistentAttributeType.EMBEDDED ),
/**
* @see org.hibernate.annotations.Any
*/
ANY( null ),
/**
* @see jakarta.persistence.OneToOne
*/
ONE_TO_ONE( PersistentAttributeType.ONE_TO_ONE ),
/**
* @see jakarta.persistence.ManyToOne
*/
MANY_TO_ONE( PersistentAttributeType.MANY_TO_ONE ),
/**
* @see jakarta.persistence.ElementCollection
*/
ELEMENT_COLLECTION( PersistentAttributeType.ELEMENT_COLLECTION ),
/**
* @see jakarta.persistence.OneToMany
*/
ONE_TO_MANY( PersistentAttributeType.ONE_TO_MANY ),
/**
* @see jakarta.persistence.ManyToMany
*/
MANY_TO_MANY( PersistentAttributeType.MANY_TO_MANY );
private final PersistentAttributeType jpaClassification;
@ -24,6 +65,9 @@ public enum AttributeClassification {
this.jpaClassification = jpaClassification;
}
/**
* The associated {@link PersistentAttributeType}, if one
*/
public PersistentAttributeType getJpaClassification() {
return jpaClassification;
}

View File

@ -12,7 +12,7 @@ import java.util.concurrent.ConcurrentHashMap;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -44,7 +44,7 @@ import org.hibernate.metamodel.model.domain.internal.MapMember;
import org.hibernate.metamodel.model.domain.internal.MappedSuperclassTypeImpl;
import org.hibernate.metamodel.model.domain.internal.PluralAttributeBuilder;
import org.hibernate.metamodel.model.domain.internal.SingularAttributeImpl;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.internal.PropertyAccessMapImpl;
import org.hibernate.property.access.spi.Getter;

View File

@ -14,8 +14,8 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -24,7 +24,7 @@ import org.hibernate.mapping.IndexBackref;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.property.access.internal.PropertyAccessStrategyBackRefImpl;
import org.hibernate.property.access.internal.PropertyAccessStrategyIndexBackRefImpl;

View File

@ -13,8 +13,8 @@ import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
import org.hibernate.metamodel.spi.ManagedTypeRepresentationResolver;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;

View File

@ -6,7 +6,7 @@
*/
package org.hibernate.metamodel.internal;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
/**
* Marker interface for standard EmbeddableInstantiator implementations.

View File

@ -12,7 +12,7 @@ import java.util.function.BiConsumer;
import org.hibernate.mapping.IndexedConsumer;
import org.hibernate.metamodel.mapping.internal.EmbeddedAttributeMapping;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.query.spi.NavigablePath;
import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup;

View File

@ -8,7 +8,7 @@ package org.hibernate.metamodel.mapping;
import java.util.function.Consumer;
import org.hibernate.query.DotIdentifierSequence;
import org.hibernate.spi.DotIdentifierSequence;
import org.hibernate.boot.spi.SessionFactoryOptions;
/**

View File

@ -32,7 +32,7 @@ import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadata;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.internal.PropertyAccessStrategyBackRefImpl;

View File

@ -49,7 +49,7 @@ import org.hibernate.metamodel.mapping.SelectableMappings;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadata;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -35,7 +35,7 @@ import org.hibernate.metamodel.mapping.SelectableMappings;
import org.hibernate.metamodel.mapping.SingularAttributeMapping;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -10,8 +10,8 @@ import org.hibernate.bytecode.spi.ReflectionOptimizer;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.internal.EmbeddableInstantiatorPojoStandard;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.property.access.internal.PropertyAccessStrategyMixedImpl;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -18,8 +18,8 @@ import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.internal.EmbeddableInstantiatorProxied;
import org.hibernate.metamodel.internal.StandardEmbeddableInstantiator;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EntityInstantiator;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -4,26 +4,28 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.metamodel.model.convert;
import jakarta.persistence.AttributeConverter;
package org.hibernate.metamodel.model.convert.spi;
import org.hibernate.SessionFactory;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.model.convert.internal.JpaAttributeConverterImpl;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.resource.beans.spi.ManagedBean;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.JavaType;
import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry;
import org.hibernate.type.spi.TypeConfiguration;
import jakarta.persistence.AttributeConverter;
/**
* Factory for converter instances
*
* @author Steve Ebersole
*/
public class Converters {
/**
* Generates a BasicValueConverter based on an {@link AttributeConverter}
*/
public static <O,R> BasicValueConverter<O,R> jpaAttributeConverter(
JavaType<R> relationalJtd,
JavaType<O> domainJtd,

View File

@ -8,7 +8,7 @@ package org.hibernate.metamodel.model.domain;
import java.util.Objects;
import org.hibernate.query.DotIdentifierSequence;
import org.hibernate.spi.DotIdentifierSequence;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.query.spi.NavigablePath;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.metamodel;
package org.hibernate.metamodel.spi;
import java.util.function.Supplier;

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.metamodel;
package org.hibernate.metamodel.spi;
import org.hibernate.Incubating;
import org.hibernate.bytecode.spi.ReflectionOptimizer;

View File

@ -9,7 +9,6 @@ package org.hibernate.metamodel.spi;
import java.util.function.Consumer;
import org.hibernate.EntityNameResolver;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
import org.hibernate.proxy.ProxyFactory;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -11,7 +11,6 @@ import java.util.function.Supplier;
import org.hibernate.Incubating;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.persister.entity.EntityPersister;

View File

@ -4,11 +4,12 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.metamodel;
package org.hibernate.metamodel.spi;
import org.hibernate.Incubating;
import org.hibernate.bytecode.spi.ReflectionOptimizer;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.type.descriptor.java.JavaType;

View File

@ -6,13 +6,15 @@
*/
package org.hibernate.property.access.spi;
import org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy;
/**
* Describes access to a particular persistent property in terms of getting and setting
* values.
* <p/>
* Instances are obtained from {@link PropertyAccessStrategy}
*
* @see org.hibernate.metamodel.ManagedTypeRepresentationStrategy
* @see ManagedTypeRepresentationStrategy
*
* @author Steve Ebersole
* @author Gavin King

View File

@ -6,7 +6,7 @@
*/
package org.hibernate.query.hql.internal;
import org.hibernate.query.DotIdentifierSequence;
import org.hibernate.spi.DotIdentifierSequence;
import org.hibernate.query.hql.spi.SemanticPathPart;
/**

View File

@ -9,7 +9,7 @@ package org.hibernate.query.spi;
import java.io.Serializable;
import org.hibernate.internal.util.StringHelper;
import org.hibernate.query.DotIdentifierSequence;
import org.hibernate.spi.DotIdentifierSequence;
import org.hibernate.query.sqm.spi.EntityIdentifierNavigablePath;
/**

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.query;
package org.hibernate.spi;
import java.util.function.BiFunction;

View File

@ -21,7 +21,7 @@ import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.VirtualModelPart;
import org.hibernate.metamodel.mapping.internal.ToOneAttributeMapping;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.property.access.spi.PropertyAccess;
import org.hibernate.proxy.HibernateProxy;
import org.hibernate.query.spi.NavigablePath;

View File

@ -8,7 +8,7 @@ package org.hibernate.tuple;
import java.io.Serializable;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
import org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy;
/**
* Contract for implementors responsible for instantiating entity/component instances.

View File

@ -6,7 +6,7 @@
*/
package org.hibernate.tuple;
import org.hibernate.metamodel.ManagedTypeRepresentationStrategy;
import org.hibernate.metamodel.spi.ManagedTypeRepresentationStrategy;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.property.access.spi.Getter;

View File

@ -33,7 +33,7 @@ import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
import org.hibernate.property.access.spi.PropertyAccess;

View File

@ -11,7 +11,7 @@ import java.util.Currency;
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -14,7 +14,8 @@ import org.hibernate.NaturalIdLoadAccess;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.NaturalIdMapping;
import org.hibernate.query.Query;
import org.hibernate.stat.Statistics;
@ -22,9 +23,9 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.After;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
/**
* Test case for NaturalId annotation
@ -48,15 +49,19 @@ public class NaturalIdTest extends BaseCoreFunctionalTestCase {
@Test
public void testMappingProperties() {
ClassMetadata metaData = sessionFactory().getClassMetadata(
Citizen.class
);
assertTrue(
"Class should have a natural key", metaData
.hasNaturalIdentifier()
);
int[] propertiesIndex = metaData.getNaturalIdentifierProperties();
assertTrue( "Wrong number of elements", propertiesIndex.length == 2 );
final EntityMappingType citizenEntityMapping = sessionFactory()
.getRuntimeMetamodels()
.getEntityMappingType( Citizen.class );
final NaturalIdMapping naturalIdMapping = citizenEntityMapping.getNaturalIdMapping();
assertThat( naturalIdMapping )
.withFailMessage( "Class should have a natural key" )
.isNotNull();
assertThat( naturalIdMapping.getNaturalIdAttributes() )
.withFailMessage( "Expecting 2 natural-id attributes, got " + naturalIdMapping.getNaturalIdAttributes().size() )
.hasSize( 2 );
}
@Test

View File

@ -11,7 +11,7 @@ import java.util.List;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.type.spi.CompositeTypeImplementor;
import org.hibernate.testing.TestForIssue;

View File

@ -6,7 +6,7 @@
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embeddable;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embeddab
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -6,7 +6,7 @@
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -6,6 +6,6 @@
*/
/**
* Tests for custom {@link org.hibernate.metamodel.EmbeddableInstantiator} usage
* Tests for custom {@link org.hibernate.metamodel.spi.EmbeddableInstantiator} usage
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.embedded;

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.RuntimeMetamodels;
@ -19,7 +19,6 @@ import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf;
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf2;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.Property;
import org.hibernate.metamodel.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.RepresentationMode;
import org.hibernate.metamodel.RuntimeMetamodels;
@ -19,7 +19,6 @@ import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.DomainModelScope;
import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.intf2;
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -6,7 +6,7 @@
*/
package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.registered;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.mapping.embeddable.strategy.instantiator.register
import java.util.function.Supplier;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.EmbeddableInstantiator;
import org.hibernate.metamodel.spi.EmbeddableInstantiator;
/**
* @author Steve Ebersole

View File

@ -18,7 +18,7 @@ import jakarta.persistence.Id;
import org.hibernate.annotations.Table;
import org.hibernate.boot.MetadataSources;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.tool.hbm2ddl.SchemaExport;
import org.hibernate.tool.schema.TargetType;
@ -98,9 +98,12 @@ public class TableCommentTest extends BaseNonConfigCoreFunctionalTestCase {
}
private String getTableName() {
SessionFactoryImplementor sessionFactoryImplementor = sessionFactory();
ClassMetadata tableWithCommentMetadata = sessionFactoryImplementor.getClassMetadata( TableWithComment.class );
return ((AbstractEntityPersister) tableWithCommentMetadata).getTableName();
final SessionFactoryImplementor sessionFactory = sessionFactory();
final EntityMappingType entityMappingType = sessionFactory
.getRuntimeMetamodels()
.getEntityMappingType( TableWithComment.class );
return ( (AbstractEntityPersister) entityMappingType ).getTableName();
}
private void createSchema(Class[] annotatedClasses) {