`org.hibernate.metamodel.RuntimeMetamodels`

This commit is contained in:
Steve Ebersole 2019-12-11 15:03:04 -06:00
parent 1580613f8a
commit 28c0b05d0f
31 changed files with 298 additions and 146 deletions

View File

@ -17,7 +17,6 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceUnitUtil; import javax.persistence.PersistenceUnitUtil;
import javax.persistence.Query; import javax.persistence.Query;
import javax.persistence.SynchronizationType; import javax.persistence.SynchronizationType;
import javax.persistence.criteria.CriteriaBuilder;
import org.hibernate.CustomEntityDirtinessStrategy; import org.hibernate.CustomEntityDirtinessStrategy;
import org.hibernate.EntityNameResolver; import org.hibernate.EntityNameResolver;
@ -43,6 +42,7 @@ import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.factory.IdentifierGeneratorFactory; import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.metadata.ClassMetadata; import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata; import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.RuntimeMetamodels;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.JpaMetamodel; import org.hibernate.metamodel.model.domain.JpaMetamodel;
import org.hibernate.metamodel.spi.MetamodelImplementor; import org.hibernate.metamodel.spi.MetamodelImplementor;
@ -51,7 +51,6 @@ import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.query.criteria.HibernateCriteriaBuilder; import org.hibernate.query.criteria.HibernateCriteriaBuilder;
import org.hibernate.query.spi.QueryEngine; import org.hibernate.query.spi.QueryEngine;
import org.hibernate.query.sqm.NodeBuilder;
import org.hibernate.service.spi.ServiceRegistryImplementor; import org.hibernate.service.spi.ServiceRegistryImplementor;
import org.hibernate.stat.spi.StatisticsImplementor; import org.hibernate.stat.spi.StatisticsImplementor;
import org.hibernate.type.Type; import org.hibernate.type.Type;
@ -140,6 +139,11 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
return delegate.getStatistics(); return delegate.getStatistics();
} }
@Override
public RuntimeMetamodels getRuntimeMetamodels() {
return delegate.getRuntimeMetamodels();
}
@Override @Override
public void close() throws HibernateException { public void close() throws HibernateException {
delegate.close(); delegate.close();

View File

@ -31,7 +31,8 @@ import org.hibernate.engine.profile.FetchProfile;
import org.hibernate.exception.spi.SQLExceptionConverter; import org.hibernate.exception.spi.SQLExceptionConverter;
import org.hibernate.graph.spi.RootGraphImplementor; import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.IdentifierGenerator;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.RuntimeMetamodels;
import org.hibernate.metamodel.spi.MetamodelImplementor; import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
@ -81,7 +82,7 @@ public interface SessionFactoryImplementor
} }
@Override @Override
default DomainMetamodel getDomainModel() { default MappingMetamodel getDomainModel() {
return getMetamodel(); return getMetamodel();
} }
@ -104,6 +105,8 @@ public interface SessionFactoryImplementor
@Override @Override
StatisticsImplementor getStatistics(); StatisticsImplementor getStatistics();
RuntimeMetamodels getRuntimeMetamodels();
/** /**
* Access to the ServiceRegistry for this SessionFactory. * Access to the ServiceRegistry for this SessionFactory.
* *

View File

@ -101,10 +101,11 @@ import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass; import org.hibernate.mapping.RootClass;
import org.hibernate.metadata.ClassMetadata; import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata; import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.RuntimeMetamodels;
import org.hibernate.metamodel.internal.RuntimeMetamodelsImpl;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.JpaMetamodel; import org.hibernate.metamodel.model.domain.JpaMetamodel;
import org.hibernate.metamodel.model.domain.internal.DomainMetamodelImpl; import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
import org.hibernate.metamodel.spi.DomainMetamodel;
import org.hibernate.metamodel.spi.MetamodelImplementor; import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Loadable; import org.hibernate.persister.entity.Loadable;
@ -179,7 +180,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
// todo : org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor too? // todo : org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor too?
private final transient DomainMetamodel metamodel; private final transient RuntimeMetamodels runtimeMetamodels;
private final PersistenceUnitUtil jpaPersistenceUnitUtil; private final PersistenceUnitUtil jpaPersistenceUnitUtil;
private final transient CacheImplementor cacheAccess; private final transient CacheImplementor cacheAccess;
private final transient QueryEngine queryEngine; private final transient QueryEngine queryEngine;
@ -298,8 +299,9 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
primeSecondLevelCacheRegions( bootMetamodel ); primeSecondLevelCacheRegions( bootMetamodel );
this.metamodel = typeConfiguration.scope( this ); final RuntimeMetamodelsImpl runtimeMetamodels = new RuntimeMetamodelsImpl();
( (DomainMetamodelImpl) metamodel ).finishInitialization( this.runtimeMetamodels = runtimeMetamodels;
runtimeMetamodels.finishInitialization(
bootMetamodel, bootMetamodel,
bootstrapContext, bootstrapContext,
this this
@ -334,10 +336,10 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() ); final FetchProfile fetchProfile = new FetchProfile( mappingProfile.getName() );
for ( org.hibernate.mapping.FetchProfile.Fetch mappingFetch : mappingProfile.getFetches() ) { for ( org.hibernate.mapping.FetchProfile.Fetch mappingFetch : mappingProfile.getFetches() ) {
// resolve the persister owning the fetch // resolve the persister owning the fetch
final String entityName = metamodel.getImportedName( mappingFetch.getEntity() ); final String entityName = this.runtimeMetamodels.getImportedName( mappingFetch.getEntity() );
final EntityPersister owner = entityName == null final EntityPersister owner = entityName == null
? null ? null
: metamodel.getEntityDescriptor( entityName ); : this.runtimeMetamodels.getMappingMetamodel().getEntityDescriptor( entityName );
if ( owner == null ) { if ( owner == null ) {
throw new HibernateException( throw new HibernateException(
"Unable to resolve entity reference [" + mappingFetch.getEntity() "Unable to resolve entity reference [" + mappingFetch.getEntity()
@ -715,7 +717,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
@Override @Override
public MetamodelImplementor getMetamodel() { public MetamodelImplementor getMetamodel() {
validateNotClosed(); validateNotClosed();
return (MetamodelImplementor) metamodel; return (MetamodelImplementor) runtimeMetamodels.getMappingMetamodel();
} }
@Override @Override
@ -826,8 +828,8 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
cacheAccess.close(); cacheAccess.close();
} }
if ( metamodel != null ) { if ( runtimeMetamodels != null ) {
( (DomainMetamodelImpl) metamodel ).close(); ( (MappingMetamodelImpl) runtimeMetamodels.getMappingMetamodel() ).close();
} }
if ( queryEngine != null ) { if ( queryEngine != null ) {
@ -1021,9 +1023,15 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
} }
} }
@Override
public RuntimeMetamodels getRuntimeMetamodels() {
return runtimeMetamodels;
}
@Override @Override
public JpaMetamodel getJpaMetamodel() { public JpaMetamodel getJpaMetamodel() {
return getMetamodel().getJpaMetamodel(); return runtimeMetamodels.getJpaMetamodel();
} }
@Override @Override

View File

@ -4,7 +4,7 @@
* License: GNU Lesser General Public License (LGPL), version 2.1 or later * 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 * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/ */
package org.hibernate.metamodel.spi; package org.hibernate.metamodel;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -14,45 +14,29 @@ import org.hibernate.graph.RootGraph;
import org.hibernate.metamodel.mapping.MappingModelExpressable; import org.hibernate.metamodel.mapping.MappingModelExpressable;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.metamodel.model.domain.JpaMetamodel;
import org.hibernate.metamodel.model.domain.ManagedDomainType;
import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.sqm.SqmExpressable; import org.hibernate.query.sqm.SqmExpressable;
import org.hibernate.type.BasicType;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
* Access to information about Hibernate's runtime type system * Access to information about Hibernate's runtime relational mapping model
* *
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Incubating @Incubating
public interface DomainMetamodel { public interface MappingMetamodel {
/**
* Access to the JPA metamodel sub-set of the overall run-time metamodel
*
* @apiNote The distinction is mainly used in building SQM trees, which rely
* on the JPA type subset
*/
JpaMetamodel getJpaMetamodel();
/** /**
* The TypeConfiguration this metamodel is associated with * The TypeConfiguration this metamodel is associated with
*/ */
default TypeConfiguration getTypeConfiguration() { TypeConfiguration getTypeConfiguration();
return getJpaMetamodel().getTypeConfiguration();
}
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Mapping model // SQM model -> Mapping model
/** /**
* todo (6.0) : POC!!! Intended for use in SQM -> SQL translation * todo (6.0) : POC!!! Intended for use in SQM -> SQL translation
*
* @param sqmExpressable
* @return
*/ */
MappingModelExpressable resolveMappingExpressable(SqmExpressable<?> sqmExpressable); MappingModelExpressable resolveMappingExpressable(SqmExpressable<?> sqmExpressable);
@ -60,28 +44,7 @@ public interface DomainMetamodel {
* Given a Java type, determine the corresponding AllowableParameterType to * Given a Java type, determine the corresponding AllowableParameterType to
* use implicitly * use implicitly
*/ */
default <T> AllowableParameterType<T> resolveQueryParameterType(Class<T> javaType) { <T> AllowableParameterType<T> resolveQueryParameterType(Class<T> javaType);
final BasicType basicType = getTypeConfiguration().getBasicTypeForJavaType( javaType );
if ( basicType != null ) {
//noinspection unchecked
return basicType;
}
final ManagedDomainType<T> managedType = getJpaMetamodel().findManagedType( javaType );
if ( managedType instanceof AllowableParameterType ) {
//noinspection unchecked
return (AllowableParameterType) managedType;
}
return null;
}
/**
* Given an (assumed) entity instance, determine its descriptor
*
* @see org.hibernate.EntityNameResolver
*/
EntityPersister determineEntityPersister(Object entity);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -0,0 +1,57 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.metamodel;
import org.hibernate.Incubating;
import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.model.domain.JpaMetamodel;
/**
* Access to Hibernate's runtime metamodels which includes its domain-model (JPA impl) and its
* relational-mapping model
*
* @author Steve Ebersole
*/
@Incubating
public interface RuntimeMetamodels {
/**
* Access to the JPA / domain metamodel
*/
JpaMetamodel getJpaMetamodel();
/**
* Access to the relational-mapping model
*/
MappingMetamodel getMappingMetamodel();
// some convenience methods...
default EntityMappingType getEntityMappingType(String entityName) {
return getMappingMetamodel().getEntityDescriptor( entityName );
}
default EntityMappingType getEntityMappingType(Class entityType) {
return getMappingMetamodel().getEntityDescriptor( entityType );
}
default PluralAttributeMapping getPluralAttributeMapping(String role) {
return getMappingMetamodel().findCollectionDescriptor( role ).getAttributeMapping();
}
default EmbeddableValuedModelPart getEmbedded(String role) {
// todo (6.0) : I think we might need a form of mapping-model look-up for embeddables, something like:
throw new NotYetImplementedFor6Exception( getClass() );
}
default String getImportedName(String name) {
return getMappingMetamodel().getImportedName( name );
}
}

View File

@ -7,11 +7,28 @@
package org.hibernate.metamodel; package org.hibernate.metamodel;
/** /**
* At the end of the day, any "value mapping" (id, version, attribute, collection element, etc) can be one
* of a few classifications. This defines an enumeration of those classifications
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public enum ValueClassification { public enum ValueClassification {
/**
* The mapped value is a basic value (String, Date, etc).
*/
BASIC, BASIC,
/**
* ANY is a Hibernate specific concept. It is essentially a "reverse discrimination". Here, the association itself
* defines a discriminator to the associated entity - sort of the reverse of discriminator-inheritance. Here the
* various associated types can be unrelated in terms of mapped inheritance.
*/
ANY, ANY,
/**
* An {@link javax.persistence.Embeddable} value
*/
EMBEDDABLE, EMBEDDABLE,
/**
* Reference to an entity
*/
ENTITY ENTITY
} }

View File

@ -43,16 +43,16 @@ import org.hibernate.metamodel.model.domain.PersistentAttribute;
import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; import org.hibernate.metamodel.model.domain.SingularPersistentAttribute;
import org.hibernate.metamodel.model.domain.internal.AttributeContainer; import org.hibernate.metamodel.model.domain.internal.AttributeContainer;
import org.hibernate.metamodel.model.domain.internal.BasicTypeImpl; import org.hibernate.metamodel.model.domain.internal.BasicTypeImpl;
import org.hibernate.metamodel.model.domain.internal.DomainMetamodelImpl; import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
import org.hibernate.metamodel.model.domain.internal.EntityTypeImpl; import org.hibernate.metamodel.model.domain.internal.EntityTypeImpl;
import org.hibernate.metamodel.model.domain.internal.MappedSuperclassTypeImpl; import org.hibernate.metamodel.model.domain.internal.MappedSuperclassTypeImpl;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry; import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
/** /**
* Defines a context for storing information during the building of the {@link DomainMetamodelImpl}. * Defines a context for storing information during the building of the {@link MappingMetamodelImpl}.
* <p/> * <p/>
* This contextual information includes data needing to be processed in a second pass as well as * This contextual information includes data needing to be processed in a second pass as well as
* cross-references into the built metamodel classes. * cross-references into the built metamodel classes.
@ -94,7 +94,7 @@ public class MetadataContext {
* Stack of PersistentClass being process. Last in the list is the highest in the stack. * Stack of PersistentClass being process. Last in the list is the highest in the stack.
*/ */
private List<PersistentClass> stackOfPersistentClassesBeingProcessed = new ArrayList<>(); private List<PersistentClass> stackOfPersistentClassesBeingProcessed = new ArrayList<>();
private DomainMetamodel metamodel; private MappingMetamodel metamodel;
public MetadataContext( public MetadataContext(
JpaMetamodel jpaMetamodel, JpaMetamodel jpaMetamodel,
@ -125,7 +125,7 @@ public class MetadataContext {
return typeConfiguration.getJavaTypeDescriptorRegistry(); return typeConfiguration.getJavaTypeDescriptorRegistry();
} }
DomainMetamodel getMetamodel() { MappingMetamodel getMetamodel() {
return metamodel; return metamodel;
} }

View File

@ -0,0 +1,55 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
*/
package org.hibernate.metamodel.internal;
import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.internal.SessionFactoryImpl;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.RuntimeMetamodels;
import org.hibernate.metamodel.model.domain.JpaMetamodel;
import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
/**
* @author Steve Ebersole
*/
public class RuntimeMetamodelsImpl implements RuntimeMetamodels {
private JpaMetamodel jpaMetamodel;
private MappingMetamodel mappingMetamodel;
public RuntimeMetamodelsImpl() {
}
@Override
public JpaMetamodel getJpaMetamodel() {
return jpaMetamodel;
}
@Override
public MappingMetamodel getMappingMetamodel() {
return mappingMetamodel;
}
/**
* Chicken-and-egg because things try to use the SessionFactory (specifically the MappingMetamodel)
* before it is ready. So we do this fugly code...
*/
public void finishInitialization(
MetadataImplementor bootMetamodel,
BootstrapContext bootstrapContext,
SessionFactoryImpl sessionFactory) {
final MappingMetamodelImpl mappingMetamodel = bootstrapContext.getTypeConfiguration().scope( sessionFactory );
this.mappingMetamodel = mappingMetamodel;
mappingMetamodel.finishInitialization(
bootMetamodel,
bootstrapContext,
sessionFactory
);
this.jpaMetamodel = mappingMetamodel.getJpaMetamodel();
}
}

View File

@ -77,7 +77,7 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent
PersistentClass bootDescriptor, PersistentClass bootDescriptor,
RuntimeModelCreationContext creationContext) { RuntimeModelCreationContext creationContext) {
final SessionFactoryImplementor sessionFactory = creationContext.getSessionFactory(); final SessionFactoryImplementor sessionFactory = creationContext.getSessionFactory();
final JavaTypeDescriptorRegistry jtdRegistry = sessionFactory.getTypeConfiguration() final JavaTypeDescriptorRegistry jtdRegistry = creationContext.getTypeConfiguration()
.getJavaTypeDescriptorRegistry(); .getJavaTypeDescriptorRegistry();
final Class<?> mappedJavaType = bootDescriptor.getMappedClass(); final Class<?> mappedJavaType = bootDescriptor.getMappedClass();

View File

@ -18,6 +18,12 @@ import org.hibernate.sql.results.graph.Fetchable;
import org.hibernate.sql.results.graph.FetchableContainer; import org.hibernate.sql.results.graph.FetchableContainer;
/** /**
* An embedded (embeddable-valued) model part.
*
* @see javax.persistence.Embedded
* @see javax.persistence.EmbeddedId
* @see javax.persistence.Embeddable
*
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public interface EmbeddableValuedModelPart extends ModelPart, Fetchable, FetchableContainer, TableGroupJoinProducer { public interface EmbeddableValuedModelPart extends ModelPart, Fetchable, FetchableContainer, TableGroupJoinProducer {

View File

@ -63,7 +63,7 @@ import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadata; import org.hibernate.metamodel.mapping.StateArrayContributorMetadata;
import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess; import org.hibernate.metamodel.mapping.StateArrayContributorMetadataAccess;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.persister.collection.CollectionPersister; import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.collection.SQLLoadableCollection; import org.hibernate.persister.collection.SQLLoadableCollection;
@ -690,7 +690,7 @@ public class MappingModelCreationHelper {
final RuntimeModelCreationContext creationContext = creationProcess.getCreationContext(); final RuntimeModelCreationContext creationContext = creationProcess.getCreationContext();
final SessionFactoryImplementor sessionFactory = creationContext.getSessionFactory(); final SessionFactoryImplementor sessionFactory = creationContext.getSessionFactory();
final Dialect dialect = sessionFactory.getJdbcServices().getJdbcEnvironment().getDialect(); final Dialect dialect = sessionFactory.getJdbcServices().getJdbcEnvironment().getDialect();
final DomainMetamodel domainModel = creationContext.getDomainModel(); final MappingMetamodel domainModel = creationContext.getDomainModel();
final CollectionPersister collectionDescriptor = domainModel.findCollectionDescriptor( bootValueMapping.getRole() ); final CollectionPersister collectionDescriptor = domainModel.findCollectionDescriptor( bootValueMapping.getRole() );
assert collectionDescriptor != null; assert collectionDescriptor != null;

View File

@ -6,9 +6,14 @@
*/ */
/** /**
* Hibernate's run-time mapping model. * Hibernate's run-time mapping model. This model defines the mapping of the application's domain model
* to database objects (tables, columns, etc).
* *
* @implNote At the moment, this mapping model is built on top of the * @implNote At the moment, this mapping model is built on top of the {@link org.hibernate.persister} package.
* {@link org.hibernate.persister} package. *
* @implSpec This entire package is considered an SPI and incubating at the moment
*/ */
@Incubating
package org.hibernate.metamodel.mapping; package org.hibernate.metamodel.mapping;
import org.hibernate.Incubating;

View File

@ -15,7 +15,7 @@ import javax.persistence.metamodel.ManagedType;
import org.hibernate.Incubating; import org.hibernate.Incubating;
import org.hibernate.graph.spi.RootGraphImplementor; import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.spi.TypeConfiguration; import org.hibernate.type.spi.TypeConfiguration;
@ -23,7 +23,7 @@ import org.hibernate.type.spi.TypeConfiguration;
* Hibernate extension to the JPA {@link javax.persistence.metamodel.Metamodel} contract * Hibernate extension to the JPA {@link javax.persistence.metamodel.Metamodel} contract
* *
* @author Steve Ebersole * @author Steve Ebersole
* @see DomainMetamodel * @see MappingMetamodel
*/ */
@Incubating @Incubating
public interface JpaMetamodel extends javax.persistence.metamodel.Metamodel { public interface JpaMetamodel extends javax.persistence.metamodel.Metamodel {

View File

@ -42,15 +42,16 @@ import org.hibernate.internal.HEMLogging;
import org.hibernate.internal.util.collections.ArrayHelper; import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.mapping.Collection; import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.PersistentClass;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetting; import org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetting;
import org.hibernate.metamodel.mapping.MappingModelExpressable; import org.hibernate.metamodel.mapping.MappingModelExpressable;
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess; import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.model.domain.EmbeddableDomainType; import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.metamodel.model.domain.JpaMetamodel; import org.hibernate.metamodel.model.domain.JpaMetamodel;
import org.hibernate.metamodel.model.domain.ManagedDomainType; import org.hibernate.metamodel.model.domain.ManagedDomainType;
import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.DomainMetamodel;
import org.hibernate.metamodel.spi.EntityRepresentationStrategy; import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
import org.hibernate.metamodel.spi.MetamodelImplementor; import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
@ -70,14 +71,17 @@ import static org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetti
* *
* Really more of the mapping model then the domain model, though it does have reference to the `JpaMetamodel` * Really more of the mapping model then the domain model, though it does have reference to the `JpaMetamodel`
* *
* NOTE : we suppress deprecation warnings because at the moment we still implement a deprecated API so
* have to reference deprecated things
* *
* @author Steve Ebersole * @author Steve Ebersole
* @author Emmanuel Bernard * @author Emmanuel Bernard
* @author Andrea Boriero * @author Andrea Boriero
*/ */
public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplementor, Serializable { @SuppressWarnings("deprecation")
public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplementor, Serializable {
// todo : Integrate EntityManagerLogger into CoreMessageLogger // todo : Integrate EntityManagerLogger into CoreMessageLogger
private static final EntityManagerMessageLogger log = HEMLogging.messageLogger( DomainMetamodelImpl.class ); private static final EntityManagerMessageLogger log = HEMLogging.messageLogger( MappingMetamodelImpl.class );
private static final String INVALID_IMPORT = ""; private static final String INVALID_IMPORT = "";
private static final String[] EMPTY_IMPLEMENTORS = new String[0]; private static final String[] EMPTY_IMPLEMENTORS = new String[0];
@ -123,7 +127,7 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
// //
// To account for this, we track both paradigms here... // To account for this, we track both paradigms here...
/** /*
* There can be multiple instances of an Embeddable type, each one being relative to its parent entity. * There can be multiple instances of an Embeddable type, each one being relative to its parent entity.
*/ */
@ -142,12 +146,16 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
private final Map<String, String[]> implementorsCache = new ConcurrentHashMap<>(); private final Map<String, String[]> implementorsCache = new ConcurrentHashMap<>();
public DomainMetamodelImpl(SessionFactoryImplementor sessionFactory, TypeConfiguration typeConfiguration) { public MappingMetamodelImpl(SessionFactoryImplementor sessionFactory, TypeConfiguration typeConfiguration) {
this.sessionFactory = sessionFactory; this.sessionFactory = sessionFactory;
this.typeConfiguration = typeConfiguration; this.typeConfiguration = typeConfiguration;
this.jpaMetamodel = new JpaMetamodelImpl( typeConfiguration ); this.jpaMetamodel = new JpaMetamodelImpl( typeConfiguration );
} }
public JpaMetamodel getJpaMetamodel() {
return jpaMetamodel;
}
public void finishInitialization( public void finishInitialization(
MetadataImplementor bootModel, MetadataImplementor bootModel,
BootstrapContext bootstrapContext, BootstrapContext bootstrapContext,
@ -170,8 +178,8 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
} }
@Override @Override
public DomainMetamodel getDomainModel() { public MappingMetamodel getDomainModel() {
return DomainMetamodelImpl.this; return MappingMetamodelImpl.this;
} }
}; };
@ -294,6 +302,7 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
if ( indexType != null && indexType.isEntityType() && !indexType.isAnyType() ) { if ( indexType != null && indexType.isEntityType() && !indexType.isAnyType() ) {
String entityName = ( (org.hibernate.type.EntityType) indexType ).getAssociatedEntityName(); String entityName = ( (org.hibernate.type.EntityType) indexType ).getAssociatedEntityName();
Set<String> roles = collectionRolesByEntityParticipant.get( entityName ); Set<String> roles = collectionRolesByEntityParticipant.get( entityName );
//noinspection Java8MapApi
if ( roles == null ) { if ( roles == null ) {
roles = new HashSet<>(); roles = new HashSet<>();
collectionRolesByEntityParticipant.put( entityName, roles ); collectionRolesByEntityParticipant.put( entityName, roles );
@ -304,6 +313,7 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
if ( elementType.isEntityType() && !elementType.isAnyType() ) { if ( elementType.isEntityType() && !elementType.isAnyType() ) {
String entityName = ( (org.hibernate.type.EntityType) elementType ).getAssociatedEntityName(); String entityName = ( (org.hibernate.type.EntityType) elementType ).getAssociatedEntityName();
Set<String> roles = collectionRolesByEntityParticipant.get( entityName ); Set<String> roles = collectionRolesByEntityParticipant.get( entityName );
//noinspection Java8MapApi
if ( roles == null ) { if ( roles == null ) {
roles = new HashSet<>(); roles = new HashSet<>();
collectionRolesByEntityParticipant.put( entityName, roles ); collectionRolesByEntityParticipant.put( entityName, roles );
@ -339,16 +349,6 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
return typeConfiguration; return typeConfiguration;
} }
@Override
public JpaMetamodel getJpaMetamodel() {
return this.jpaMetamodel;
}
@Override
public EntityPersister determineEntityPersister(Object entity) {
return findEntityDescriptor( entity.getClass() );
}
@Override @Override
public void visitEntityDescriptors(Consumer<EntityPersister> action) { public void visitEntityDescriptors(Consumer<EntityPersister> action) {
entityPersisterMap.values().forEach( action ); entityPersisterMap.values().forEach( action );
@ -423,42 +423,38 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
} }
@Override @Override
@SuppressWarnings({ "unchecked" })
public <X> EntityDomainType<X> entity(Class<X> cls) { public <X> EntityDomainType<X> entity(Class<X> cls) {
return getJpaMetamodel().entity( cls ); return jpaMetamodel.entity( cls );
} }
@Override @Override
@SuppressWarnings({ "unchecked" })
public <X> ManagedDomainType<X> managedType(Class<X> cls) { public <X> ManagedDomainType<X> managedType(Class<X> cls) {
return getJpaMetamodel().managedType( cls ); return jpaMetamodel.managedType( cls );
} }
@Override @Override
@SuppressWarnings({ "unchecked" })
public <X> EmbeddableDomainType<X> embeddable(Class<X> cls) { public <X> EmbeddableDomainType<X> embeddable(Class<X> cls) {
return getJpaMetamodel().embeddable( cls ); return jpaMetamodel.embeddable( cls );
} }
@Override @Override
public Set<ManagedType<?>> getManagedTypes() { public Set<ManagedType<?>> getManagedTypes() {
return getJpaMetamodel().getManagedTypes(); return jpaMetamodel.getManagedTypes();
} }
@Override @Override
public Set<EntityType<?>> getEntities() { public Set<EntityType<?>> getEntities() {
return getJpaMetamodel().getEntities(); return jpaMetamodel.getEntities();
} }
@Override @Override
public Set<EmbeddableType<?>> getEmbeddables() { public Set<EmbeddableType<?>> getEmbeddables() {
return getJpaMetamodel().getEmbeddables(); return jpaMetamodel.getEmbeddables();
} }
@Override @Override
@SuppressWarnings("unchecked")
public <X> EntityDomainType<X> entity(String entityName) { public <X> EntityDomainType<X> entity(String entityName) {
return getJpaMetamodel().entity( entityName ); return jpaMetamodel.entity( entityName );
} }
@Override @Override
@ -596,15 +592,13 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
} }
@Override @Override
@SuppressWarnings("unchecked")
public <T> RootGraphImplementor<T> findEntityGraphByName(String name) { public <T> RootGraphImplementor<T> findEntityGraphByName(String name) {
return getJpaMetamodel().findEntityGraphByName( name ); return jpaMetamodel.findEntityGraphByName( name );
} }
@Override @Override
@SuppressWarnings("unchecked")
public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass) { public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass) {
return getJpaMetamodel().findEntityGraphsByJavaType( entityClass ); return jpaMetamodel.findEntityGraphsByJavaType( entityClass );
} }
@Override @Override
@ -709,4 +703,21 @@ public class DomainMetamodelImpl implements DomainMetamodel, MetamodelImplemento
throw new UnsupportedOperationException( "Cannot determine proper mapping model expressable for " + sqmExpressable ); throw new UnsupportedOperationException( "Cannot determine proper mapping model expressable for " + sqmExpressable );
} }
@Override
public <T> AllowableParameterType<T> resolveQueryParameterType(Class<T> javaType) {
final BasicType basicType = getTypeConfiguration().getBasicTypeForJavaType( javaType );
if ( basicType != null ) {
//noinspection unchecked
return basicType;
}
final ManagedDomainType<T> managedType = jpaMetamodel.findManagedType( javaType );
if ( managedType instanceof AllowableParameterType ) {
//noinspection unchecked
return (AllowableParameterType) managedType;
}
return null;
}
} }

View File

@ -17,6 +17,7 @@ import org.hibernate.MappingException;
import org.hibernate.Metamodel; import org.hibernate.Metamodel;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.graph.spi.RootGraphImplementor; import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.model.domain.EmbeddableDomainType; import org.hibernate.metamodel.model.domain.EmbeddableDomainType;
import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.EntityDomainType;
import org.hibernate.metamodel.model.domain.ManagedDomainType; import org.hibernate.metamodel.model.domain.ManagedDomainType;
@ -29,10 +30,10 @@ import org.hibernate.type.spi.TypeConfiguration;
* *
* @author Steve Ebersole * @author Steve Ebersole
* *
* @deprecated (since 6.0) - Prefer {@link org.hibernate.metamodel.spi.DomainMetamodel} * @deprecated (since 6.0) - Prefer {@link MappingMetamodel}
*/ */
@Deprecated @Deprecated
public interface MetamodelImplementor extends DomainMetamodel, Metamodel { public interface MetamodelImplementor extends MappingMetamodel, Metamodel {
/** /**
* Access to the TypeConfiguration in effect for this SessionFactory/Metamodel * Access to the TypeConfiguration in effect for this SessionFactory/Metamodel
* *

View File

@ -9,6 +9,7 @@ package org.hibernate.metamodel.spi;
import org.hibernate.boot.spi.BootstrapContext; import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.boot.spi.MetadataImplementor; import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.persister.spi.PersisterCreationContext; import org.hibernate.persister.spi.PersisterCreationContext;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry; import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry; import org.hibernate.type.descriptor.java.spi.JavaTypeDescriptorRegistry;
@ -24,7 +25,7 @@ public interface RuntimeModelCreationContext extends PersisterCreationContext {
MetadataImplementor getBootModel(); MetadataImplementor getBootModel();
DomainMetamodel getDomainModel(); MappingMetamodel getDomainModel();
default TypeConfiguration getTypeConfiguration() { default TypeConfiguration getTypeConfiguration() {
return getBootstrapContext().getTypeConfiguration(); return getBootstrapContext().getTypeConfiguration();

View File

@ -77,6 +77,7 @@ import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.mapping.internal.PluralAttributeMappingImpl; import org.hibernate.metamodel.mapping.internal.PluralAttributeMappingImpl;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.PropertyMapping; import org.hibernate.persister.entity.PropertyMapping;
import org.hibernate.persister.entity.Queryable; import org.hibernate.persister.entity.Queryable;
@ -259,7 +260,11 @@ public abstract class AbstractCollectionPersister
public AbstractCollectionPersister( public AbstractCollectionPersister(
Collection collectionBootDescriptor, Collection collectionBootDescriptor,
CollectionDataAccess cacheAccessStrategy, CollectionDataAccess cacheAccessStrategy,
PersisterCreationContext creationContext) throws MappingException, CacheException { PersisterCreationContext pcc) throws MappingException, CacheException {
assert pcc instanceof RuntimeModelCreationContext;
final RuntimeModelCreationContext creationContext = (RuntimeModelCreationContext) pcc;
final Value elementBootDescriptor = collectionBootDescriptor.getElement(); final Value elementBootDescriptor = collectionBootDescriptor.getElement();
final Value indexBootDescriptor = collectionBootDescriptor instanceof IndexedCollection final Value indexBootDescriptor = collectionBootDescriptor instanceof IndexedCollection
? ( (IndexedCollection) collectionBootDescriptor ).getIndex() ? ( (IndexedCollection) collectionBootDescriptor ).getIndex()
@ -284,7 +289,7 @@ public abstract class AbstractCollectionPersister
collectionType = collectionBootDescriptor.getCollectionType(); collectionType = collectionBootDescriptor.getCollectionType();
navigableRole = new NavigableRole( collectionBootDescriptor.getRole() ); navigableRole = new NavigableRole( collectionBootDescriptor.getRole() );
entityName = collectionBootDescriptor.getOwnerEntityName(); entityName = collectionBootDescriptor.getOwnerEntityName();
ownerPersister = factory.getEntityPersister( entityName ); ownerPersister = creationContext.getDomainModel().getEntityDescriptor( entityName );
queryLoaderName = collectionBootDescriptor.getLoaderName(); queryLoaderName = collectionBootDescriptor.getLoaderName();
isMutable = collectionBootDescriptor.isMutable(); isMutable = collectionBootDescriptor.isMutable();
mappedByProperty = collectionBootDescriptor.getMappedByProperty(); mappedByProperty = collectionBootDescriptor.getMappedByProperty();
@ -346,7 +351,7 @@ public abstract class AbstractCollectionPersister
if ( elementType.isEntityType() ) { if ( elementType.isEntityType() ) {
String entityName = ( (EntityType) elementType ).getAssociatedEntityName(); String entityName = ( (EntityType) elementType ).getAssociatedEntityName();
elementPersister = factory.getEntityPersister( entityName ); elementPersister = creationContext.getDomainModel().getEntityDescriptor( entityName );
// NativeSQL: collect element column and auto-aliases // NativeSQL: collect element column and auto-aliases
} }
@ -2416,6 +2421,11 @@ public abstract class AbstractCollectionPersister
this.attributeMapping = attributeMapping; this.attributeMapping = attributeMapping;
} }
@Override
public PluralAttributeMapping getAttributeMapping() {
return attributeMapping;
}
@Override @Override
public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) { public boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) {
if ( influencers.hasEnabledFilters() ) { if ( influencers.hasEnabledFilters() ) {

View File

@ -25,6 +25,7 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.IdentifierGenerator; import org.hibernate.id.IdentifierGenerator;
import org.hibernate.metadata.CollectionMetadata; import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.CollectionClassification; import org.hibernate.metamodel.CollectionClassification;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.model.convert.spi.BasicValueConverter; import org.hibernate.metamodel.model.convert.spi.BasicValueConverter;
import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
@ -296,6 +297,10 @@ public interface CollectionPersister extends CollectionDefinition {
boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session); boolean isAffectedByEnabledFilters(SharedSessionContractImplementor session);
default PluralAttributeMapping getAttributeMapping() {
throw new UnsupportedOperationException( "CollectionPersister used for [" + getRole() + "] does not support SQL AST" );
}
default boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) { default boolean isAffectedByEnabledFilters(LoadQueryInfluencers influencers) {
throw new UnsupportedOperationException( "CollectionPersister used for [" + getRole() + "] does not support SQL AST" ); throw new UnsupportedOperationException( "CollectionPersister used for [" + getRole() + "] does not support SQL AST" );
} }

View File

@ -1084,7 +1084,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
} }
else { else {
final ManagedDomainType managedDomainType = getSession().getFactory() final ManagedDomainType managedDomainType = getSession().getFactory()
.getDomainModel() .getRuntimeMetamodels()
.getJpaMetamodel() .getJpaMetamodel()
.managedType( javaType ); .managedType( javaType );
if ( managedDomainType != null ) { if ( managedDomainType != null ) {
@ -1119,7 +1119,7 @@ public abstract class AbstractQuery<R> implements QueryImplementor<R> {
} }
else { else {
final ManagedDomainType managedDomainType = getSession().getFactory() final ManagedDomainType managedDomainType = getSession().getFactory()
.getDomainModel() .getRuntimeMetamodels()
.getJpaMetamodel() .getJpaMetamodel()
.managedType( javaType ); .managedType( javaType );
if ( managedDomainType != null ) { if ( managedDomainType != null ) {

View File

@ -113,10 +113,13 @@ import static org.hibernate.query.internal.QueryHelper.highestPrecedenceType;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class SqmCriteriaNodeBuilder implements NodeBuilder { public class SqmCriteriaNodeBuilder implements NodeBuilder {
/**
* Simplified creation from a SessionFactory
*/
public static SqmCriteriaNodeBuilder create(SessionFactoryImplementor sf) { public static SqmCriteriaNodeBuilder create(SessionFactoryImplementor sf) {
return new SqmCriteriaNodeBuilder( return new SqmCriteriaNodeBuilder(
sf.getQueryEngine(), sf.getQueryEngine(),
sf.getMetamodel().getJpaMetamodel(), sf.getRuntimeMetamodels().getJpaMetamodel(),
sf.getServiceRegistry() sf.getServiceRegistry()
); );
} }

View File

@ -24,7 +24,7 @@ import org.hibernate.metamodel.model.domain.internal.BasicSqmPathSource;
import org.hibernate.metamodel.model.domain.internal.DomainModelHelper; import org.hibernate.metamodel.model.domain.internal.DomainModelHelper;
import org.hibernate.metamodel.model.domain.internal.EmbeddedSqmPathSource; import org.hibernate.metamodel.model.domain.internal.EmbeddedSqmPathSource;
import org.hibernate.metamodel.model.domain.internal.EntitySqmPathSource; import org.hibernate.metamodel.model.domain.internal.EntitySqmPathSource;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.query.sqm.SqmExpressable; import org.hibernate.query.sqm.SqmExpressable;
@ -103,7 +103,7 @@ public class SqmMappingModelHelper {
public static MappingModelExpressable resolveMappingModelExpressable( public static MappingModelExpressable resolveMappingModelExpressable(
SqmTypedNode<?> sqmNode, SqmTypedNode<?> sqmNode,
DomainMetamodel domainModel, MappingMetamodel domainModel,
Function<NavigablePath,TableGroup> tableGroupLocator) { Function<NavigablePath,TableGroup> tableGroupLocator) {
if ( sqmNode instanceof SqmPath ) { if ( sqmNode instanceof SqmPath ) {
return resolveSqmPath( (SqmPath) sqmNode, domainModel, tableGroupLocator ); return resolveSqmPath( (SqmPath) sqmNode, domainModel, tableGroupLocator );
@ -119,7 +119,7 @@ public class SqmMappingModelHelper {
private static ModelPart resolveSqmPath( private static ModelPart resolveSqmPath(
SqmPath<?> sqmPath, SqmPath<?> sqmPath,
DomainMetamodel domainModel, MappingMetamodel domainModel,
Function<NavigablePath,TableGroup> tableGroupLocator) { Function<NavigablePath,TableGroup> tableGroupLocator) {
if ( sqmPath instanceof SqmTreatedPath ) { if ( sqmPath instanceof SqmTreatedPath ) {

View File

@ -22,7 +22,7 @@ import org.hibernate.metamodel.mapping.Bindable;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.MappingModelExpressable; import org.hibernate.metamodel.mapping.MappingModelExpressable;
import org.hibernate.metamodel.model.domain.AllowableParameterType; import org.hibernate.metamodel.model.domain.AllowableParameterType;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.query.IllegalQueryOperationException; import org.hibernate.query.IllegalQueryOperationException;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.query.spi.QueryParameterBinding; import org.hibernate.query.spi.QueryParameterBinding;
@ -156,7 +156,7 @@ public class SqmUtil {
QueryParameterBindings domainParamBindings, QueryParameterBindings domainParamBindings,
DomainParameterXref domainParameterXref, DomainParameterXref domainParameterXref,
Map<QueryParameterImplementor<?>, Map<SqmParameter, List<JdbcParameter>>> jdbcParamXref, Map<QueryParameterImplementor<?>, Map<SqmParameter, List<JdbcParameter>>> jdbcParamXref,
DomainMetamodel domainModel, MappingMetamodel domainModel,
Function<NavigablePath, TableGroup> tableGroupLocator, Function<NavigablePath, TableGroup> tableGroupLocator,
SharedSessionContractImplementor session) { SharedSessionContractImplementor session) {
final JdbcParameterBindings jdbcParameterBindings = new JdbcParameterBindingsImpl( final JdbcParameterBindings jdbcParameterBindings = new JdbcParameterBindingsImpl(

View File

@ -20,7 +20,7 @@ import org.hibernate.boot.TempTableDdlTransactionHandling;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.util.collections.Stack; import org.hibernate.internal.util.collections.Stack;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Joinable; import org.hibernate.persister.entity.Joinable;
import org.hibernate.query.sqm.internal.DomainParameterXref; import org.hibernate.query.sqm.internal.DomainParameterXref;
@ -106,7 +106,7 @@ public class TableBasedUpdateHandler
private ExecutionDelegate resolveDelegate(ExecutionContext executionContext) { private ExecutionDelegate resolveDelegate(ExecutionContext executionContext) {
final SessionFactoryImplementor sessionFactory = getSessionFactory(); final SessionFactoryImplementor sessionFactory = getSessionFactory();
final DomainMetamodel domainModel = sessionFactory.getDomainModel(); final MappingMetamodel domainModel = sessionFactory.getDomainModel();
final EntityPersister entityDescriptor = domainModel.getEntityDescriptor( getSqmDeleteOrUpdateStatement().getTarget().getEntityName() ); final EntityPersister entityDescriptor = domainModel.getEntityDescriptor( getSqmDeleteOrUpdateStatement().getTarget().getEntityName() );
final String rootEntityName = entityDescriptor.getRootEntityName(); final String rootEntityName = entityDescriptor.getRootEntityName();

View File

@ -13,7 +13,7 @@ import java.util.function.Function;
import org.hibernate.HibernateException; import org.hibernate.HibernateException;
import org.hibernate.LockMode; import org.hibernate.LockMode;
import org.hibernate.NotYetImplementedFor6Exception; import org.hibernate.NotYetImplementedFor6Exception;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.query.NavigablePath; import org.hibernate.query.NavigablePath;
import org.hibernate.query.spi.QueryOptions; import org.hibernate.query.spi.QueryOptions;
@ -246,7 +246,7 @@ public class StandardSqmUpdateTranslator
getJdbcParamsBySqmParam().put( sqmParameter, jdbcParametersForSqm ); getJdbcParamsBySqmParam().put( sqmParameter, jdbcParametersForSqm );
} }
else { else {
final DomainMetamodel domainModel = getCreationContext().getDomainModel(); final MappingMetamodel domainModel = getCreationContext().getDomainModel();
final TypeConfiguration typeConfiguration = domainModel.getTypeConfiguration(); final TypeConfiguration typeConfiguration = domainModel.getTypeConfiguration();
final Expression valueExpression = (Expression) sqmAssignment.getValue().accept( this ); final Expression valueExpression = (Expression) sqmAssignment.getValue().accept( this );

View File

@ -7,7 +7,7 @@
package org.hibernate.sql.ast.spi; package org.hibernate.sql.ast.spi;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
/** /**
@ -19,7 +19,7 @@ import org.hibernate.service.ServiceRegistry;
public interface SqlAstCreationContext { public interface SqlAstCreationContext {
SessionFactoryImplementor getSessionFactory(); SessionFactoryImplementor getSessionFactory();
DomainMetamodel getDomainModel(); MappingMetamodel getDomainModel();
ServiceRegistry getServiceRegistry(); ServiceRegistry getServiceRegistry();

View File

@ -15,6 +15,7 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function; import java.util.function.Function;
@ -25,13 +26,17 @@ import org.hibernate.SessionFactory;
import org.hibernate.SessionFactoryObserver; import org.hibernate.SessionFactoryObserver;
import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService; import org.hibernate.boot.cfgxml.spi.CfgXmlAccessService;
import org.hibernate.boot.spi.BasicTypeRegistration; import org.hibernate.boot.spi.BasicTypeRegistration;
import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.boot.spi.MetadataBuildingContext;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.id.uuid.LocalObjectUuidHelper; import org.hibernate.id.uuid.LocalObjectUuidHelper;
import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.SessionFactoryRegistry; import org.hibernate.internal.SessionFactoryRegistry;
import org.hibernate.metamodel.model.domain.internal.DomainMetamodelImpl; import org.hibernate.metamodel.RuntimeMetamodels;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.internal.RuntimeMetamodelsImpl;
import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.query.BinaryArithmeticOperator; import org.hibernate.query.BinaryArithmeticOperator;
import org.hibernate.query.internal.QueryHelper; import org.hibernate.query.internal.QueryHelper;
import org.hibernate.query.sqm.SqmExpressable; import org.hibernate.query.sqm.SqmExpressable;
@ -142,7 +147,7 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
scope.setMetadataBuildingContext( metadataBuildingContext ); scope.setMetadataBuildingContext( metadataBuildingContext );
} }
public DomainMetamodel scope(SessionFactoryImplementor sessionFactory) { public MappingMetamodelImpl scope(SessionFactoryImplementor sessionFactory) {
log.debugf( "Scoping TypeConfiguration [%s] to SessionFactoryImplementor [%s]", this, sessionFactory ); log.debugf( "Scoping TypeConfiguration [%s] to SessionFactoryImplementor [%s]", this, sessionFactory );
if ( scope.getMetadataBuildingContext() == null ) { if ( scope.getMetadataBuildingContext() == null ) {
@ -151,7 +156,8 @@ public class TypeConfiguration implements SessionFactoryObserver, Serializable {
scope.setSessionFactory( sessionFactory ); scope.setSessionFactory( sessionFactory );
sessionFactory.addObserver( this ); sessionFactory.addObserver( this );
return new DomainMetamodelImpl( sessionFactory, this );
return new MappingMetamodelImpl( sessionFactory, this );
} }
/** /**

View File

@ -35,7 +35,7 @@ import org.hibernate.jpa.test.metamodel.Phone;
import org.hibernate.jpa.test.metamodel.Product; import org.hibernate.jpa.test.metamodel.Product;
import org.hibernate.jpa.test.metamodel.ShelfLife; import org.hibernate.jpa.test.metamodel.ShelfLife;
import org.hibernate.jpa.test.metamodel.Spouse; import org.hibernate.jpa.test.metamodel.Spouse;
import org.hibernate.metamodel.model.domain.internal.DomainMetamodelImpl; import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
import org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate; import org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate;
import org.hibernate.testing.FailureExpected; import org.hibernate.testing.FailureExpected;
@ -77,7 +77,7 @@ public class QueryBuilderTest extends BaseEntityManagerFunctionalTestCase {
em.getTransaction().begin(); em.getTransaction().begin();
CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaBuilder cb = em.getCriteriaBuilder();
DomainMetamodelImpl mm = (DomainMetamodelImpl) em.getMetamodel(); MappingMetamodelImpl mm = (MappingMetamodelImpl) em.getMetamodel();
CriteriaQuery<Integer> cquery = cb.createQuery( Integer.class ); CriteriaQuery<Integer> cquery = cb.createQuery( Integer.class );
Root<Product> product = cquery.from( Product.class ); Root<Product> product = cquery.from( Product.class );
@ -135,7 +135,7 @@ public class QueryBuilderTest extends BaseEntityManagerFunctionalTestCase {
em.getTransaction().begin(); em.getTransaction().begin();
CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaBuilder cb = em.getCriteriaBuilder();
DomainMetamodelImpl mm = (DomainMetamodelImpl) em.getMetamodel(); MappingMetamodelImpl mm = (MappingMetamodelImpl) em.getMetamodel();
EntityType<Phone> Phone_ = mm.entity( Phone.class ); EntityType<Phone> Phone_ = mm.entity( Phone.class );
CriteriaQuery<Phone> cquery = cb.createQuery( Phone.class ); CriteriaQuery<Phone> cquery = cb.createQuery( Phone.class );
@ -157,7 +157,7 @@ public class QueryBuilderTest extends BaseEntityManagerFunctionalTestCase {
EntityManager em = getOrCreateEntityManager(); EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin(); em.getTransaction().begin();
CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaBuilder cb = em.getCriteriaBuilder();
DomainMetamodelImpl mm = (DomainMetamodelImpl) em.getMetamodel(); MappingMetamodelImpl mm = (MappingMetamodelImpl) em.getMetamodel();
EntityType<Product> Product_ = mm.entity( Product.class ); EntityType<Product> Product_ = mm.entity( Product.class );
// toFloat // toFloat
@ -189,7 +189,7 @@ public class QueryBuilderTest extends BaseEntityManagerFunctionalTestCase {
EntityManager em = getOrCreateEntityManager(); EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin(); em.getTransaction().begin();
CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaBuilder cb = em.getCriteriaBuilder();
DomainMetamodelImpl mm = (DomainMetamodelImpl) em.getMetamodel(); MappingMetamodelImpl mm = (MappingMetamodelImpl) em.getMetamodel();
CriteriaQuery<Customer> cquery = cb.createQuery( Customer.class ); CriteriaQuery<Customer> cquery = cb.createQuery( Customer.class );
Root<Customer> customer = cquery.from( Customer.class ); Root<Customer> customer = cquery.from( Customer.class );
@ -236,7 +236,7 @@ public class QueryBuilderTest extends BaseEntityManagerFunctionalTestCase {
EntityManager em = getOrCreateEntityManager(); EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin(); em.getTransaction().begin();
CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaBuilder cb = em.getCriteriaBuilder();
DomainMetamodelImpl mm = (DomainMetamodelImpl) em.getMetamodel(); MappingMetamodelImpl mm = (MappingMetamodelImpl) em.getMetamodel();
CriteriaQuery<java.sql.Date> dateQuery = cb.createQuery( java.sql.Date.class ); CriteriaQuery<java.sql.Date> dateQuery = cb.createQuery( java.sql.Date.class );
dateQuery.from( Customer.class ); dateQuery.from( Customer.class );

View File

@ -11,14 +11,12 @@ import java.util.Optional;
import org.hibernate.boot.spi.BootstrapContext; import org.hibernate.boot.spi.BootstrapContext;
import org.hibernate.boot.spi.MetadataImplementor; import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.engine.config.spi.ConfigurationService;
import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetting; import org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetting;
import org.hibernate.metamodel.model.domain.JpaMetamodel; import org.hibernate.metamodel.model.domain.JpaMetamodel;
import org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl; import org.hibernate.metamodel.model.domain.internal.JpaMetamodelImpl;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.query.hql.HqlTranslator; import org.hibernate.query.hql.HqlTranslator;
import org.hibernate.query.hql.internal.StandardHqlTranslator; import org.hibernate.query.hql.internal.StandardHqlTranslator;
@ -35,7 +33,6 @@ import org.hibernate.testing.orm.junit.DomainModelScope;
import org.hibernate.testing.orm.junit.FailureExpected; import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.ServiceRegistryScope; import org.hibernate.testing.orm.junit.ServiceRegistryScope;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
/** /**
@ -89,7 +86,7 @@ public class HqlTranslationNoFactoryTests {
} }
@Override @Override
public DomainMetamodel getDomainModel() { public MappingMetamodel getDomainModel() {
throw new UnsupportedOperationException( "DomainMetamodel not available" ); throw new UnsupportedOperationException( "DomainMetamodel not available" );
} }
} }

View File

@ -23,7 +23,7 @@ import org.hibernate.LockOptions;
import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.loader.ast.internal.LoaderSelectBuilder; import org.hibernate.loader.ast.internal.LoaderSelectBuilder;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.persister.entity.EntityPersister; import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.sql.ast.tree.from.TableGroup; import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.ast.tree.from.TableGroupJoin; import org.hibernate.sql.ast.tree.from.TableGroupJoin;
@ -64,7 +64,7 @@ public class MappedFetchTests {
@Test @Test
public void baseline(SessionFactoryScope scope) { public void baseline(SessionFactoryScope scope) {
final SessionFactoryImplementor sessionFactory = scope.getSessionFactory(); final SessionFactoryImplementor sessionFactory = scope.getSessionFactory();
final DomainMetamodel domainModel = sessionFactory.getDomainModel(); final MappingMetamodel domainModel = sessionFactory.getDomainModel();
final EntityPersister rootEntityDescriptor = domainModel.getEntityDescriptor( RootEntity.class ); final EntityPersister rootEntityDescriptor = domainModel.getEntityDescriptor( RootEntity.class );
final SelectStatement sqlAst = LoaderSelectBuilder.createSelect( final SelectStatement sqlAst = LoaderSelectBuilder.createSelect(

View File

@ -9,7 +9,7 @@ package org.hibernate.orm.test.metamodel.mapping.collections;
import org.hibernate.metamodel.mapping.AttributeMapping; import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EntityMappingType; import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.PluralAttributeMapping; import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.testing.orm.domain.StandardDomainModel; import org.hibernate.testing.orm.domain.StandardDomainModel;
import org.hibernate.testing.orm.domain.gambit.EntityOfSets; import org.hibernate.testing.orm.domain.gambit.EntityOfSets;
@ -36,7 +36,7 @@ public class PluralAttributeMappingTests {
@Test @Test
public void testLists(SessionFactoryScope scope) { public void testLists(SessionFactoryScope scope) {
final DomainMetamodel domainModel = scope.getSessionFactory().getDomainModel(); final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfLists.class ); final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfLists.class );
assertThat( containerEntityDescriptor.getNumberOfAttributeMappings(), is( 7 ) ); assertThat( containerEntityDescriptor.getNumberOfAttributeMappings(), is( 7 ) );
@ -62,7 +62,7 @@ public class PluralAttributeMappingTests {
@Test @Test
public void testSets(SessionFactoryScope scope) { public void testSets(SessionFactoryScope scope) {
final DomainMetamodel domainModel = scope.getSessionFactory().getDomainModel(); final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfSets.class ); final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfSets.class );
assertThat( containerEntityDescriptor.getNumberOfAttributeMappings(), is( 9 ) ); assertThat( containerEntityDescriptor.getNumberOfAttributeMappings(), is( 9 ) );
@ -94,7 +94,7 @@ public class PluralAttributeMappingTests {
@Test @Test
public void testMaps(SessionFactoryScope scope) { public void testMaps(SessionFactoryScope scope) {
final DomainMetamodel domainModel = scope.getSessionFactory().getDomainModel(); final MappingMetamodel domainModel = scope.getSessionFactory().getDomainModel();
final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfMaps.class ); final EntityMappingType containerEntityDescriptor = domainModel.getEntityDescriptor( EntityOfMaps.class );
// 8 for now, until entity-valued map keys is supported // 8 for now, until entity-valued map keys is supported

View File

@ -16,7 +16,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SessionImplementor; import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.metamodel.spi.DomainMetamodel; import org.hibernate.metamodel.MappingMetamodel;
import org.hibernate.metamodel.spi.MetamodelImplementor; import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.query.spi.QueryEngine; import org.hibernate.query.spi.QueryEngine;
import org.hibernate.service.ServiceRegistry; import org.hibernate.service.ServiceRegistry;
@ -53,7 +53,7 @@ public class EntityManagerUnwrapTest extends BaseEntityManagerFunctionalTestCase
entityManagerFactory().unwrap( javax.persistence.metamodel.Metamodel.class ); entityManagerFactory().unwrap( javax.persistence.metamodel.Metamodel.class );
entityManagerFactory().unwrap( Metamodel.class ); entityManagerFactory().unwrap( Metamodel.class );
entityManagerFactory().unwrap( MetamodelImplementor.class ); entityManagerFactory().unwrap( MetamodelImplementor.class );
entityManagerFactory().unwrap( DomainMetamodel.class ); entityManagerFactory().unwrap( MappingMetamodel.class );
entityManagerFactory().unwrap( QueryEngine.class ); entityManagerFactory().unwrap( QueryEngine.class );
} }