HHH-12713 Restore backward compatibility for users of org.hibernate.metamodel.spi.MetamodelImplementor

* Move the interface back from org.hibernate.metamodel.model.domain.spi to org.hibernate.metamodel.spi
* Restore method addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph)
* Make sure that findEntityGraphsByType returns List<EntityGraph<? superT>> once again,
and not List<RootGraphImplementor<? super T>>.
This commit is contained in:
Yoann Rodière 2018-10-26 11:05:19 +02:00 committed by Steve Ebersole
parent d0fb16dded
commit 0d8db10fcb
11 changed files with 34 additions and 14 deletions

View File

@ -47,7 +47,7 @@ import org.hibernate.id.IdentifierGenerator;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.proxy.EntityNotFoundDelegate;

View File

@ -35,7 +35,7 @@ import org.hibernate.engine.query.spi.QueryPlanCache;
import org.hibernate.exception.spi.SQLExceptionConverter;
import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.proxy.EntityNotFoundDelegate;

View File

@ -100,7 +100,7 @@ import org.hibernate.mapping.RootClass;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.internal.MetamodelImpl;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Loadable;
import org.hibernate.procedure.ProcedureCall;
@ -590,7 +590,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
@Override
public <T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass) {
return getMetamodel().findEntityGraphsByType( entityClass );
return getMetamodel().findEntityGraphsByJavaType( entityClass );
}

View File

@ -157,7 +157,7 @@ import org.hibernate.jpa.spi.HibernateEntityManagerImplementor;
import org.hibernate.loader.criteria.CriteriaLoader;
import org.hibernate.loader.custom.CustomLoader;
import org.hibernate.loader.custom.CustomQuery;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.param.CollectionFilterKeyParameterSpecification;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;

View File

@ -65,7 +65,7 @@ import org.hibernate.metamodel.model.domain.spi.EntityTypeDescriptor;
import org.hibernate.metamodel.model.domain.spi.IdentifiableTypeDescriptor;
import org.hibernate.metamodel.model.domain.spi.ManagedTypeDescriptor;
import org.hibernate.metamodel.model.domain.spi.MappedSuperclassTypeDescriptor;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.persister.entity.Queryable;
@ -760,6 +760,11 @@ public class MetamodelImpl implements MetamodelImplementor, Serializable {
}
}
@Override
public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph) {
addNamedEntityGraph( graphName, (RootGraphImplementor<T>) entityGraph );
}
@Override
@SuppressWarnings("unchecked")
public <T> RootGraphImplementor<T> findEntityGraphByName(String name) {

View File

@ -8,6 +8,7 @@ package org.hibernate.metamodel.model.domain.spi;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.entity.EntityPersister;
/**

View File

@ -2,20 +2,24 @@
* 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
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>
*/
package org.hibernate.metamodel.model.domain.spi;
package org.hibernate.metamodel.spi;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.persistence.EntityGraph;
import org.hibernate.EntityNameResolver;
import org.hibernate.MappingException;
import org.hibernate.Metamodel;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.graph.spi.RootGraphImplementor;
import org.hibernate.metamodel.model.domain.spi.EmbeddedTypeDescriptor;
import org.hibernate.metamodel.model.domain.spi.EntityTypeDescriptor;
import org.hibernate.metamodel.model.domain.spi.ManagedTypeDescriptor;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.type.spi.TypeConfiguration;
@ -135,12 +139,22 @@ public interface MetamodelImplementor extends Metamodel {
<T> void addNamedEntityGraph(String graphName, RootGraphImplementor<T> entityGraph);
/**
* @deprecated Use {@link #addNamedEntityGraph(String, RootGraphImplementor)} instead.
*/
@Deprecated
<T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph);
<T> RootGraphImplementor<T> findEntityGraphByName(String name);
<T> List<RootGraphImplementor<? super T>> findEntityGraphsByJavaType(Class<T> entityClass);
default <T> List<RootGraphImplementor<? super T>> findEntityGraphsByType(Class<T> entityClass) {
return findEntityGraphsByJavaType( entityClass );
/**
* @deprecated Use {@link #findEntityGraphsByJavaType(Class)} instead.
*/
@Deprecated
default <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
return (List) findEntityGraphsByJavaType( entityClass );
}
void close();

View File

@ -23,7 +23,7 @@ import org.hibernate.id.uuid.LocalObjectUuidHelper;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.SessionFactoryRegistry;
import org.hibernate.metamodel.internal.MetamodelImpl;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.type.BasicTypeRegistry;
import org.hibernate.type.Type;

View File

@ -18,7 +18,7 @@ import org.hibernate.cfg.AvailableSettings;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.loader.BatchFetchStyle;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.persister.entity.EntityPersister;
import org.junit.Test;

View File

@ -13,7 +13,7 @@ import javax.persistence.Id;
import org.hibernate.SessionFactory;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.query.Query;
import org.hibernate.type.Type;

View File

@ -21,7 +21,7 @@ import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.internal.MetadataBuilderImpl;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.metamodel.model.domain.spi.MetamodelImplementor;
import org.hibernate.metamodel.spi.MetamodelImplementor;
import org.hibernate.type.descriptor.java.ImmutableMutabilityPlan;
import org.hibernate.type.descriptor.java.JavaTypeDescriptorRegistry;
import org.hibernate.type.descriptor.java.MutabilityPlan;