finally remove ClassMetadata and CollectionMetadata

(They should have been removed earlier, since they are no longer exposed)

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-06-01 10:37:44 +02:00 committed by Steve Ebersole
parent 21b7d3f229
commit efd2e90f5f
12 changed files with 3 additions and 382 deletions

View File

@ -83,7 +83,6 @@ import org.hibernate.mapping.KeyValue;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.internal.RuntimeMetamodelsImpl;
import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.model.domain.internal.MappingMetamodelImpl;
@ -907,10 +906,6 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im
return runtimeMetamodels.getMappingMetamodel().getEntityDescriptor( className ).getIdentifierPropertyName();
}
public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException {
return (CollectionMetadata) runtimeMetamodels.getMappingMetamodel().getCollectionDescriptor( roleName );
}
public Type getReferencedPropertyType(String className, String propertyName) throws MappingException {
return runtimeMetamodels.getMappingMetamodel().getEntityDescriptor( className ).getPropertyType( propertyName );
}

View File

@ -1,267 +0,0 @@
/*
* 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.metadata;
import java.util.Map;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.Type;
/**
* Exposes entity class metadata to the application
*
* @author Gavin King
*
* @deprecated Use Hibernate's mapping model {@link org.hibernate.metamodel.MappingMetamodel}
*/
@Deprecated(since = "6.0")
public interface ClassMetadata {
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// stuff that is persister-centric and/or EntityInfo-centric ~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* The name of the entity
*/
String getEntityName();
/**
* Get the name of the identifier property (or return null)
*/
String getIdentifierPropertyName();
/**
* Get the names of the class' persistent properties
*/
String[] getPropertyNames();
/**
* Get the identifier Hibernate type
*/
Type getIdentifierType();
/**
* Get the Hibernate types of the class properties
*/
Type[] getPropertyTypes();
/**
* Get the type of a particular (named) property
*/
Type getPropertyType(String propertyName) throws HibernateException;
/**
* Does this class support dynamic proxies?
*/
boolean hasProxy();
/**
* Are instances of this class mutable?
*/
boolean isMutable();
/**
* Are instances of this class versioned by a timestamp or version number column?
*/
boolean isVersioned();
/**
* Get the index of the version property
*/
int getVersionProperty();
/**
* Get the nullability of the class' persistent properties
*/
boolean[] getPropertyNullability();
/**
* Get the "laziness" of the properties of this class
*/
boolean[] getPropertyLaziness();
/**
* Does this class have an identifier property?
*/
boolean hasIdentifierProperty();
/**
* Does this entity declare a natural id?
*/
boolean hasNaturalIdentifier();
/**
* Which properties hold the natural id?
*/
int[] getNaturalIdentifierProperties();
/**
* Does this entity have mapped subclasses?
*/
boolean hasSubclasses();
/**
* Does this entity extend a mapped superclass?
*/
boolean isInherited();
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// stuff that is tuplizer-centric, but is passed a session ~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* Return the values of the mapped properties of the object
*
* @deprecated Use the form accepting SharedSessionContractImplementor instead
*/
@Deprecated(since = "5.3")
@SuppressWarnings({"UnusedDeclaration"})
default Object[] getPropertyValuesToInsert(Object entity, Map<Object,Object> mergeMap, SessionImplementor session)
throws HibernateException {
return getPropertyValuesToInsert( entity, mergeMap, (SharedSessionContractImplementor) session );
}
/**
* Return the values of the mapped properties of the object
*/
@SuppressWarnings( {"UnusedDeclaration"})
Object[] getPropertyValuesToInsert(Object entity, Map<Object,Object> mergeMap, SharedSessionContractImplementor session)
throws HibernateException;
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// stuff that is Tuplizer-centric ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/**
* The persistent class, or null
*/
Class<?> getMappedClass();
/**
* Create a class instance initialized with the given identifier
*
* @param id The identifier value to use (may be null to represent no value)
* @param session The session from which the request originated.
*
* @return The instantiated entity.
*
* @deprecated Use the form accepting SharedSessionContractImplementor instead
*/
@Deprecated(since = "5.3")
default Object instantiate(Object id, SessionImplementor session) {
return instantiate( id, (SharedSessionContractImplementor) session );
}
/**
* Create a class instance initialized with the given identifier
*
* @param id The identifier value to use (may be null to represent no value)
* @param session The session from which the request originated.
*
* @return The instantiated entity.
*/
Object instantiate(Object id, SharedSessionContractImplementor session);
/**
* Get the value of a particular (named) property
*/
Object getPropertyValue(Object object, String propertyName) throws HibernateException;
/**
* Extract the property values from the given entity.
*
* @param entity The entity from which to extract the property values.
* @return The property values.
*/
Object[] getPropertyValues(Object entity) throws HibernateException;
/**
* Set the value of a particular (named) property
*/
void setPropertyValue(Object object, String propertyName, Object value) throws HibernateException;
/**
* Set the given values to the mapped properties of the given object
*/
void setPropertyValues(Object object, Object[] values) throws HibernateException;
/**
* Get the identifier of an instance (throw an exception if no identifier property)
*
* @deprecated Use {@link #getIdentifier(Object,SharedSessionContractImplementor)} instead
*/
@Deprecated
default Object getIdentifier(Object object) throws HibernateException {
return getIdentifier( object, null );
}
/**
* Get the identifier of an instance (throw an exception if no identifier property)
*
* @param entity The entity for which to get the identifier
* @param session The session from which the request originated
*
* @return The identifier
*
* @deprecated Use {@link #getIdentifier(Object, SharedSessionContractImplementor)} instead
*/
@Deprecated
default Object getIdentifier(Object entity, SessionImplementor session) {
return getIdentifier( entity, (SharedSessionContractImplementor) session );
}
/**
* Get the identifier of an instance (throw an exception if no identifier property)
*
* @param entity The entity for which to get the identifier
* @param session The session from which the request originated
*
* @return The identifier
*/
Object getIdentifier(Object entity, SharedSessionContractImplementor session);
/**
* Inject the identifier value into the given entity.
*
* @param entity The entity to inject with the identifier value.
* @param id The value to be injected as the identifier.
* @param session The session from which is requests originates
*
* @deprecated Use {@link #setIdentifier(Object, Object, SharedSessionContractImplementor)} instead
*/
@Deprecated
default void setIdentifier(Object entity, Object id, SessionImplementor session) {
setIdentifier( entity, id, (SharedSessionContractImplementor) session );
}
/**
* Inject the identifier value into the given entity.
* @param entity The entity to inject with the identifier value.
* @param id The value to be injected as the identifier.
* @param session The session from which is requests originates
*/
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session);
/**
* Does the class implement the {@code Lifecycle} interface?
*/
@SuppressWarnings( {"UnusedDeclaration"})
boolean implementsLifecycle();
/**
* Get the version number (or timestamp) from the object's version property
* (or return null if not versioned)
*/
Object getVersion(Object object) throws HibernateException;
}

View File

@ -1,51 +0,0 @@
/*
* 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.metadata;
import org.hibernate.type.Type;
/**
* Exposes collection metadata to the application
*
* @author Gavin King
*
* @deprecated Use Hibernate's mapping model {@link org.hibernate.metamodel.MappingMetamodel}
*/
@Deprecated(since = "6.0")
public interface CollectionMetadata {
/**
* The collection key type
*/
Type getKeyType();
/**
* The collection element type
*/
Type getElementType();
/**
* The collection index type (or null if the collection has no index)
*/
Type getIndexType();
/**
* Is this collection indexed?
*/
boolean hasIndex();
/**
* The name of this collection role
*/
String getRole();
/**
* Is the collection an array?
*/
boolean isArray();
/**
* Is the collection a primitive array?
*/
boolean isPrimitiveArray();
/**
* Is the collection lazily initialized?
*/
boolean isLazy();
}

View File

@ -77,7 +77,6 @@ import org.hibernate.mapping.Property;
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.Value;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.CollectionClassification;
import org.hibernate.metamodel.mapping.CollectionPart;
import org.hibernate.metamodel.mapping.EmbeddableMappingType;
@ -1438,11 +1437,6 @@ public abstract class AbstractCollectionPersister
protected abstract void doProcessQueuedOps(PersistentCollection<?> collection, Object key, SharedSessionContractImplementor session)
throws HibernateException;
@Override @Deprecated
public CollectionMetadata getCollectionMetadata() {
return this;
}
@Override
public SessionFactoryImplementor getFactory() {
return factory;

View File

@ -23,7 +23,6 @@ import org.hibernate.engine.spi.LoadQueryInfluencers;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.id.IdentifierGenerator;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.CollectionClassification;
import org.hibernate.metamodel.mapping.ManagedMappingType;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
@ -260,14 +259,6 @@ public interface CollectionPersister extends Restrictable {
*/
String[] getCollectionSpaces();
/**
* Get the user-visible metadata for the collection (optional operation)
*
* @deprecated This operation is no longer called by Hibernate.
*/
@Deprecated(since = "6.0")
CollectionMetadata getCollectionMetadata();
/**
* Is cascade delete handled by the database-level
* foreign key constraint definition?

View File

@ -6,13 +6,11 @@
*/
package org.hibernate.persister.collection;
import org.hibernate.metadata.CollectionMetadata;
/**
* @deprecated Just used to singly extend all the deprecated collection persister roles
*/
@Deprecated
public interface DeprecatedCollectionStuff extends SQLLoadableCollection, CollectionMetadata {
public interface DeprecatedCollectionStuff extends SQLLoadableCollection {
@Override
default String getRole() {
return SQLLoadableCollection.super.getRole();

View File

@ -156,7 +156,6 @@ import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.Value;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metamodel.UnsupportedMappingException;
import org.hibernate.metamodel.mapping.Association;
import org.hibernate.metamodel.mapping.AttributeMapping;
@ -4253,11 +4252,6 @@ public abstract class AbstractEntityPersister
return entityMetamodel.getRootName();
}
@Override @Deprecated
public ClassMetadata getClassMetadata() {
return this;
}
@Override
public String getMappedSuperclass() {
return entityMetamodel.getSuperclass();
@ -4874,8 +4868,7 @@ public abstract class AbstractEntityPersister
return entityMetamodel.hasNaturalIdentifier();
}
@Override
public void setPropertyValue(Object object, String propertyName, Object value) {
private void setPropertyValue(Object object, String propertyName, Object value) {
final AttributeMapping attributeMapping = findSubPart( propertyName, this ).asAttributeMapping();
setterCache[attributeMapping.getStateArrayPosition()].set( object, value );
}

View File

@ -6,12 +6,11 @@
*/
package org.hibernate.persister.entity;
import org.hibernate.metadata.ClassMetadata;
/**
* @deprecated Just used to singly extend all the deprecated entity persister roles
*/
@Deprecated
public interface DeprecatedEntityStuff
extends OuterJoinLoadable, ClassMetadata, UniqueKeyLoadable, SQLLoadable, Lockable, Queryable {
extends OuterJoinLoadable, UniqueKeyLoadable, SQLLoadable, Lockable, Queryable {
}

View File

@ -41,7 +41,6 @@ import org.hibernate.internal.TableGroupFilterAliasGenerator;
import org.hibernate.loader.ast.spi.MultiIdLoadOptions;
import org.hibernate.loader.ast.spi.MultiNaturalIdLoader;
import org.hibernate.loader.ast.spi.NaturalIdLoader;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.ModelPart;
@ -858,14 +857,6 @@ public interface EntityPersister extends EntityMappingType, EntityMutationTarget
*/
NaturalIdDataAccess getNaturalIdCacheAccessStrategy();
/**
* Get the user-visible metadata for the class (optional operation)
*
* @deprecated This operation is no longer called by Hibernate.
*/
@Deprecated(since = "6.0")
ClassMetadata getClassMetadata();
/**
* The batch size for batch loading.
*

View File

@ -44,8 +44,6 @@ import org.hibernate.internal.util.IndexedConsumer;
import org.hibernate.loader.ast.spi.MultiIdLoadOptions;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.AttributeMappingsMap;
@ -525,11 +523,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return null;
}
@Override
public ClassMetadata getClassMetadata() {
return null;
}
@Override
public boolean isSelectBeforeUpdateRequired() {
return false;
@ -1013,10 +1006,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
return new String[0]; //To change body of implemented methods use File | Settings | File Templates.
}
public CollectionMetadata getCollectionMetadata() {
return null; //To change body of implemented methods use File | Settings | File Templates.
}
public boolean isCascadeDeleteEnabled() {
return false; //To change body of implemented methods use File | Settings | File Templates.
}

View File

@ -42,7 +42,6 @@ import org.hibernate.jpa.boot.spi.Bootstrap;
import org.hibernate.loader.ast.spi.MultiIdLoadOptions;
import org.hibernate.mapping.Collection;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.AttributeMappingsMap;
@ -552,11 +551,6 @@ public class PersisterClassProviderTest {
return null;
}
@Override
public ClassMetadata getClassMetadata() {
return null;
}
@Override
public boolean isSelectBeforeUpdateRequired() {
return false;

View File

@ -43,7 +43,6 @@ import org.hibernate.internal.StaticFilterAliasGenerator;
import org.hibernate.internal.util.IndexedConsumer;
import org.hibernate.loader.ast.spi.MultiIdLoadOptions;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMappingsList;
import org.hibernate.metamodel.mapping.AttributeMappingsMap;
@ -642,10 +641,6 @@ public class CustomPersister implements EntityPersister {
return new String[] { "CUSTOMS" };
}
public ClassMetadata getClassMetadata() {
return null;
}
public boolean[] getPropertyUpdateability() {
return MUTABILITY;
}