remove deprecated operations of MetamodelImplementor
This commit is contained in:
parent
fa9ab7bdae
commit
23324318fd
|
@ -41,8 +41,8 @@ public interface MappingMetamodel {
|
|||
/**
|
||||
* todo (6.0) : POC!!! Intended for use in SQM -> SQL translation
|
||||
*/
|
||||
MappingModelExpressable resolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator);
|
||||
MappingModelExpressable lenientlyResolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator);
|
||||
MappingModelExpressable<?> resolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator);
|
||||
MappingModelExpressable<?> lenientlyResolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator);
|
||||
|
||||
/**
|
||||
* Given a Java type, determine the corresponding BindableType to
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Set;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import jakarta.persistence.EntityGraph;
|
||||
import jakarta.persistence.metamodel.EmbeddableType;
|
||||
import jakarta.persistence.metamodel.EntityType;
|
||||
import jakarta.persistence.metamodel.ManagedType;
|
||||
|
@ -91,7 +90,6 @@ import static org.hibernate.metamodel.internal.JpaStaticMetaModelPopulationSetti
|
|||
* @author Emmanuel Bernard
|
||||
* @author Andrea Boriero
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplementor, Serializable {
|
||||
// todo : Integrate EntityManagerLogger into CoreMessageLogger
|
||||
private static final EntityManagerMessageLogger log = HEMLogging.messageLogger( MappingMetamodelImpl.class );
|
||||
|
@ -365,7 +363,6 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
|||
return entityNameResolvers;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TypeConfiguration getTypeConfiguration() {
|
||||
return typeConfiguration;
|
||||
|
@ -519,7 +516,6 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
|||
throw new UnsupportedOperationException( );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String[] getImplementors(String className) throws MappingException {
|
||||
// computeIfAbsent() can be a contention point and we expect all the values to be in the map at some point so
|
||||
|
@ -644,11 +640,6 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
|||
jpaMetamodel.addNamedEntityGraph( graphName, entityGraph );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph) {
|
||||
addNamedEntityGraph( graphName, (RootGraphImplementor<T>) entityGraph );
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> RootGraphImplementor<T> findEntityGraphByName(String name) {
|
||||
return jpaMetamodel.findEntityGraphByName( name );
|
||||
|
@ -717,55 +708,53 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
|||
private String[] doGetImplementors(Class<?> clazz) throws MappingException {
|
||||
ArrayList<String> results = new ArrayList<>();
|
||||
for ( EntityPersister checkPersister : entityPersisters().values() ) {
|
||||
if ( !Queryable.class.isInstance( checkPersister ) ) {
|
||||
continue;
|
||||
}
|
||||
final Queryable checkQueryable = Queryable.class.cast( checkPersister );
|
||||
final String checkQueryableEntityName = checkQueryable.getEntityName();
|
||||
final boolean isMappedClass = clazz.getName().equals( checkQueryableEntityName );
|
||||
if ( checkQueryable.isExplicitPolymorphism() ) {
|
||||
if ( isMappedClass ) {
|
||||
return new String[] { clazz.getName() }; // NOTE EARLY EXIT
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( isMappedClass ) {
|
||||
results.add( checkQueryableEntityName );
|
||||
if ( checkPersister instanceof Queryable ) {
|
||||
final Queryable checkQueryable = (Queryable) checkPersister;
|
||||
final String checkQueryableEntityName = checkQueryable.getEntityName();
|
||||
final boolean isMappedClass = clazz.getName().equals( checkQueryableEntityName );
|
||||
if ( checkQueryable.isExplicitPolymorphism() ) {
|
||||
if ( isMappedClass ) {
|
||||
return new String[] { clazz.getName() }; // NOTE EARLY EXIT
|
||||
}
|
||||
}
|
||||
else {
|
||||
final Class<?> mappedClass = checkQueryable.getMappedClass();
|
||||
if ( mappedClass != null && clazz.isAssignableFrom( mappedClass ) ) {
|
||||
final boolean assignableSuperclass;
|
||||
if ( checkQueryable.isInherited() ) {
|
||||
Class<?> mappedSuperclass = entityPersister( checkQueryable.getMappedSuperclass() ).getMappedClass();
|
||||
assignableSuperclass = clazz.isAssignableFrom( mappedSuperclass );
|
||||
}
|
||||
else {
|
||||
assignableSuperclass = false;
|
||||
}
|
||||
if ( !assignableSuperclass ) {
|
||||
results.add( checkQueryableEntityName );
|
||||
if ( isMappedClass ) {
|
||||
results.add( checkQueryableEntityName );
|
||||
}
|
||||
else {
|
||||
final Class<?> mappedClass = checkQueryable.getMappedClass();
|
||||
if ( mappedClass != null && clazz.isAssignableFrom( mappedClass ) ) {
|
||||
final boolean assignableSuperclass;
|
||||
if ( checkQueryable.isInherited() ) {
|
||||
Class<?> mappedSuperclass = entityPersister( checkQueryable.getMappedSuperclass() ).getMappedClass();
|
||||
assignableSuperclass = clazz.isAssignableFrom( mappedSuperclass );
|
||||
}
|
||||
else {
|
||||
assignableSuperclass = false;
|
||||
}
|
||||
if ( !assignableSuperclass ) {
|
||||
results.add( checkQueryableEntityName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return results.toArray( new String[results.size()] );
|
||||
return results.toArray( ArrayHelper.EMPTY_STRING_ARRAY );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MappingModelExpressable lenientlyResolveMappingExpressable(
|
||||
public MappingModelExpressable<?> lenientlyResolveMappingExpressable(
|
||||
SqmExpressable<?> sqmExpressable,
|
||||
Function<NavigablePath, TableGroup> tableGroupLocator) {
|
||||
return resolveMappingExpressable( sqmExpressable, tableGroupLocator );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MappingModelExpressable resolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator) {
|
||||
public MappingModelExpressable<?> resolveMappingExpressable(SqmExpressable<?> sqmExpressable, Function<NavigablePath, TableGroup> tableGroupLocator) {
|
||||
if ( sqmExpressable instanceof SqmPath ) {
|
||||
final SqmPath sqmPath = (SqmPath) sqmExpressable;
|
||||
final SqmPath<?> sqmPath = (SqmPath<?>) sqmExpressable;
|
||||
final NavigablePath navigablePath = sqmPath.getNavigablePath();
|
||||
if ( navigablePath.getParent() != null ) {
|
||||
final TableGroup parentTableGroup = tableGroupLocator.apply( navigablePath.getParent() );
|
||||
|
@ -775,7 +764,7 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
|||
}
|
||||
|
||||
if ( sqmExpressable instanceof BasicType<?> ) {
|
||||
return (BasicType) sqmExpressable;
|
||||
return (BasicType<?>) sqmExpressable;
|
||||
}
|
||||
|
||||
if ( sqmExpressable instanceof BasicSqmPathSource<?> ) {
|
||||
|
@ -791,7 +780,7 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
|||
}
|
||||
|
||||
if ( sqmExpressable instanceof EmbeddableTypeImpl ) {
|
||||
return (MappingModelExpressable) sqmExpressable;
|
||||
return (MappingModelExpressable<?>) sqmExpressable;
|
||||
}
|
||||
|
||||
if ( sqmExpressable instanceof EntityDomainType<?> ) {
|
||||
|
@ -808,7 +797,7 @@ public class MappingMetamodelImpl implements MappingMetamodel, MetamodelImplemen
|
|||
for ( int i = 0; i < components.length; i++ ) {
|
||||
components[i] = resolveMappingExpressable( tupleType.get( i ), tableGroupLocator );
|
||||
}
|
||||
final MappingModelExpressable createdMappingModelExpressable = new TupleMappingModelExpressable( components );
|
||||
final MappingModelExpressable<?> createdMappingModelExpressable = new TupleMappingModelExpressable( components );
|
||||
final MappingModelExpressable<?> existingMappingModelExpressable = tupleTypeCache.putIfAbsent(
|
||||
tupleType,
|
||||
createdMappingModelExpressable
|
||||
|
|
|
@ -7,18 +7,14 @@
|
|||
package org.hibernate.metamodel.spi;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import jakarta.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.MappingMetamodel;
|
||||
import org.hibernate.metamodel.model.domain.EntityDomainType;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
|
@ -103,39 +99,16 @@ public interface MetamodelImplementor extends MappingMetamodel, Metamodel {
|
|||
/**
|
||||
* Get the names of all entities known to this Metamodel
|
||||
*
|
||||
* @return All of the entity names
|
||||
* @return All the entity names
|
||||
*/
|
||||
String[] getAllEntityNames();
|
||||
|
||||
/**
|
||||
* Get the names of all collections known to this Metamodel
|
||||
*
|
||||
* @return All of the entity names
|
||||
* @return All the entity names
|
||||
*/
|
||||
String[] getAllCollectionRoles();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #addNamedEntityGraph(String, RootGraphImplementor)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
<T> void addNamedEntityGraph(String graphName, EntityGraph<T> entityGraph);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #findEntityGraphsByJavaType(Class)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
default <T> List<EntityGraph<? super T>> findEntityGraphsByType(Class<T> entityClass) {
|
||||
return (List) findEntityGraphsByJavaType( entityClass );
|
||||
}
|
||||
|
||||
void close();
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Co-variant returns
|
||||
|
||||
@Override
|
||||
default EntityDomainType getEntityTypeByName(String entityName) {
|
||||
return entity( entityName );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue