diff --git a/documentation/src/main/asciidoc/userguide/chapters/domain/naming.adoc b/documentation/src/main/asciidoc/userguide/chapters/domain/naming.adoc index ec90a78511..9f718917b3 100644 --- a/documentation/src/main/asciidoc/userguide/chapters/domain/naming.adoc +++ b/documentation/src/main/asciidoc/userguide/chapters/domain/naming.adoc @@ -15,22 +15,6 @@ Hibernate looks at this as 2-stage process: * Second is the resolving of this logical name to a physical name which is defined by the <> contract. - -[NOTE] -.Historical NamingStrategy contract -==== -Historically Hibernate defined just a single `org.hibernate.cfg.NamingStrategy`. That singular -NamingStrategy contract actually combined the separate concerns that are now modeled individually -as ImplicitNamingStrategy and PhysicalNamingStrategy. - -Also, the NamingStrategy contract was often not flexible enough to properly apply a given naming -"rule", either because the API lacked the information to decide or because the API was honestly -not well defined as it grew. - -Due to these limitations, `org.hibernate.cfg.NamingStrategy` has been deprecated -in favor of ImplicitNamingStrategy and PhysicalNamingStrategy. -==== - At the core, the idea behind each naming strategy is to minimize the amount of repetitive information a developer must provide for mapping a domain model. diff --git a/hibernate-core/src/main/java/org/hibernate/QueryException.java b/hibernate-core/src/main/java/org/hibernate/QueryException.java index 25d73b1f4a..09da0d4846 100644 --- a/hibernate-core/src/main/java/org/hibernate/QueryException.java +++ b/hibernate-core/src/main/java/org/hibernate/QueryException.java @@ -111,43 +111,4 @@ public class QueryException extends HibernateException { protected final String getOriginalMessage() { return super.getMessage(); } - - /** - * Wraps this exception with another, of same kind, with the specified query string. - * If this exception already has a query string defined, the same exception ({@code this}) - * is returned. Otherwise, the protected {@link #generateQueryException(String)} is called, - * to allow subclasses to properly create the correct subclass for return. - * - * @param queryString The query string that led to the QueryException - * - * @return {@code this}, if {@code this} has {@code null} for {@link #getQueryString()}; - * otherwise a new {@code QueryException} (or subclass) is returned. - * - * @deprecated This method is no longer used - */ - @Deprecated(since = "6.2", forRemoval = true) - public final QueryException wrapWithQueryString(String queryString) { - if ( this.getQueryString() != null ) { - return this; - } - - return generateQueryException( queryString ); - } - - /** - * Called from {@link #wrapWithQueryString(String)} when we really need to - * generate a new {@code QueryException} (or subclass). - * - * @implNote implementors should take care to use {@link #getOriginalMessage()} - * for the message, not {@link #getMessage()} - * - * @param queryString The query string - * - * @return The generated {@code QueryException} (or subclass) - * - * @see #getOriginalMessage() - */ - protected QueryException generateQueryException(String queryString) { - return new QueryException( getOriginalMessage(), queryString, this ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java b/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java index 2711b9aa90..bcfe513851 100644 --- a/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java +++ b/hibernate-core/src/main/java/org/hibernate/QueryParameterException.java @@ -41,9 +41,4 @@ public class QueryParameterException extends QueryException { public QueryParameterException(String message, String queryString) { super( message, queryString ); } - - @Override - protected QueryException generateQueryException(String queryString) { - return new QueryParameterException( super.getOriginalMessage(), queryString, this ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/AttributeConverterInfo.java b/hibernate-core/src/main/java/org/hibernate/boot/AttributeConverterInfo.java deleted file mode 100644 index d35bf2759f..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/boot/AttributeConverterInfo.java +++ /dev/null @@ -1,28 +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.boot; - -import jakarta.persistence.AttributeConverter; - -import org.hibernate.Remove; -import org.hibernate.boot.model.convert.spi.ConverterDescriptor; -import org.hibernate.boot.spi.MetadataBuildingContext; - -/** - * Delayed information about an AttributeConverter. Delayed until we have - * access to {@link org.hibernate.boot.internal.ClassmateContext} during - * the MetadataSources to Metadata process. - * - * @author Steve Ebersole - * - * @deprecated no longer used - */ -@Deprecated(since = "6.2", forRemoval = true) @Remove -public interface AttributeConverterInfo { - Class getConverterClass(); - ConverterDescriptor toConverterDescriptor(MetadataBuildingContext context); -} diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java index 89539da2fc..80fdc5def1 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryBuilderImpl.java @@ -75,14 +75,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement addSessionFactoryObservers( new SessionFactoryObserverForRegistration() ); } - /** - * @deprecated This constructor will be removed - */ - @Deprecated(since = "6.2", forRemoval = true) - public SessionFactoryBuilderImpl(MetadataImplementor metadata, SessionFactoryOptionsBuilder optionsBuilder) { - this( metadata, optionsBuilder, metadata.getTypeConfiguration().getMetadataBuildingContext().getBootstrapContext() ); - } - @Override public SessionFactoryBuilder applyBeanManager(Object beanManager) { this.optionsBuilder.applyBeanManager( beanManager ); diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AttributeConverterDefinitionCollector.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AttributeConverterDefinitionCollector.java deleted file mode 100644 index ba46fb6bd8..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/AttributeConverterDefinitionCollector.java +++ /dev/null @@ -1,21 +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.boot.model.internal; - -import org.hibernate.Remove; -import org.hibernate.boot.AttributeConverterInfo; -import org.hibernate.boot.model.convert.spi.ConverterRegistry; - -/** - * @author Steve Ebersole - * - * @deprecated use {@link ConverterRegistry} - */ -@Deprecated(since = "6.2", forRemoval = true) @Remove -public interface AttributeConverterDefinitionCollector extends ConverterRegistry { - void addAttributeConverter(AttributeConverterInfo info); -} diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/package-info.java b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/package-info.java index 31815d6c28..ecf4ca4244 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/naming/package-info.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/naming/package-info.java @@ -27,7 +27,7 @@ * * * - * @apiNote The API defined in this package replaced the now-deprecated interface - * {@link org.hibernate.cfg.NamingStrategy} from older versions of Hibernate. + * @apiNote The API defined in this package replaced the now-removed interface + * {@code org.hibernate.cfg.NamingStrategy} from older versions of Hibernate. */ package org.hibernate.boot.model.naming; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/FetchProfileBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/FetchProfileBinder.java index d257481db9..ea930cd1db 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/FetchProfileBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/FetchProfileBinder.java @@ -6,12 +6,15 @@ */ package org.hibernate.boot.model.source.internal.hbm; +import org.hibernate.annotations.FetchMode; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmFetchProfileType; import org.hibernate.mapping.FetchProfile; import org.hibernate.mapping.MetadataSource; import org.jboss.logging.Logger; +import static jakarta.persistence.FetchType.EAGER; + /** * @author Steve Ebersole */ @@ -69,8 +72,17 @@ public class FetchProfileBinder { context.getOrigin() ); } - profile.addFetch( entityName, fetchBinding.getAssociation(), fetchBinding.getStyle().value() ); + String association = fetchBinding.getAssociation(); + profile.addFetch( new FetchProfile.Fetch(entityName, association, fetchMode(fetchBinding.getStyle().value()), EAGER ) ); } } + private static FetchMode fetchMode(String style) { + for ( FetchMode mode: FetchMode.values() ) { + if ( mode.name().equalsIgnoreCase( style ) ) { + return mode; + } + } + throw new IllegalArgumentException( "Unknown FetchMode: " + style ); + } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java index 0966b8d6d2..4da2f61f3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/ModelBinder.java @@ -4124,8 +4124,7 @@ public class ModelBinder { final List columnNames = new ArrayList<>(); - final UniqueKey uk = new UniqueKey(); - uk.setTable( entityBinding.getTable() ); + final UniqueKey uk = new UniqueKey(entityBinding.getTable() ); for ( Property attributeBinding : attributeBindings ) { for ( Selectable selectable : attributeBinding.getSelectables() ) { if ( selectable instanceof Column ) { diff --git a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java index be6db387a1..a43b119839 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/spi/MetadataBuildingOptions.java @@ -229,14 +229,4 @@ public interface MetadataBuildingOptions { * Check to see if extensions can be hosted in CDI */ boolean isAllowExtensionsInCdi(); - - /** - * Check to see if extensions can be hosted in CDI - * - * @deprecated Use {@link #isAllowExtensionsInCdi()} - */ - @Deprecated(forRemoval = true) - default boolean disallowExtensionsInCdi() { - return !isAllowExtensionsInCdi(); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/ByteBuddyEnhancementContext.java b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/ByteBuddyEnhancementContext.java index 5e495b30f1..5b5c4c2466 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/ByteBuddyEnhancementContext.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/enhance/internal/bytebuddy/ByteBuddyEnhancementContext.java @@ -40,16 +40,6 @@ class ByteBuddyEnhancementContext { this.enhancementContext = Objects.requireNonNull( enhancementContext ); } - /** - * @deprecated as it's currently unused and we're not always actually sourcing the classes to be transformed - * from a classloader, so this getter can't always be honoured correctly. - * @return the ClassLoader provided by the underlying EnhancementContext. Might be otherwise ignored. - */ - @Deprecated(forRemoval = true) - public ClassLoader getLoadingClassLoader() { - return enhancementContext.getLoadingClassLoader(); - } - public boolean isEntityClass(TypeDescription classDescriptor) { return enhancementContext.isEntityClass( new UnloadedTypeDescription( classDescriptor ) ); } diff --git a/hibernate-core/src/main/java/org/hibernate/cache/spi/QuerySpacesHelper.java b/hibernate-core/src/main/java/org/hibernate/cache/spi/QuerySpacesHelper.java deleted file mode 100644 index cca267defd..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cache/spi/QuerySpacesHelper.java +++ /dev/null @@ -1,46 +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.cache.spi; - -import org.hibernate.Remove; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -/** - * @author Steve Ebersole - * - * @deprecated This helper class is no longer used - */ -@Deprecated(since="6.2") @Remove -public class QuerySpacesHelper { - /** - * Singleton access - */ - public static final QuerySpacesHelper INSTANCE = new QuerySpacesHelper(); - - private QuerySpacesHelper() { - } - - public String[] toStringArray(Set spacesSet) { - return (String[]) spacesSet.toArray( new String[0] ); - } - - public Set toStringSet(String[] spacesArray) { - final HashSet set = new HashSet<>(); - Collections.addAll( set, spacesArray ); - return set; - } - - public Set toSerializableSet(String[] spacesArray) { - final HashSet set = new HashSet<>(); - Collections.addAll( set, spacesArray ); - return set; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index be1ce5ff42..c3c40ef5f8 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -210,15 +210,4 @@ public interface AvailableSettings * {@code hibernate.event.listener.eventType packageName.ClassName1, packageName.ClassName2} */ String EVENT_LISTENER_PREFIX = "hibernate.event.listener"; - - /** - * @deprecated There are much better ways to control the flush mode of a session, - * for example, {@link org.hibernate.SessionBuilder#flushMode} or - * {@link org.hibernate.Session#setHibernateFlushMode}. - * - * @see org.hibernate.jpa.HibernateHints#HINT_FLUSH_MODE - */ - @Deprecated(since = "6.2", forRemoval = true) - @SuppressWarnings("DeprecatedIsStillUsed") - String FLUSH_MODE = "org.hibernate.flushMode"; } diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java index 5a78d79b2b..0cc8e91abb 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Configuration.java @@ -1001,17 +1001,6 @@ public class Configuration { } } - /** - * @deprecated use {@link #addSqlFunction(String, SqmFunctionDescriptor)} - */ - @Deprecated(since = "6.5", forRemoval = true) - public Map getSqlFunctions() { - if ( customFunctionDescriptors == null ) { - customFunctionDescriptors = new HashMap<>(); - } - return customFunctionDescriptors; - } - /** * Adds a {@linkplain SqmFunctionDescriptor function descriptor} to * this configuration. diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/DefaultComponentSafeNamingStrategy.java b/hibernate-core/src/main/java/org/hibernate/cfg/DefaultComponentSafeNamingStrategy.java deleted file mode 100644 index b3fa5b394a..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cfg/DefaultComponentSafeNamingStrategy.java +++ /dev/null @@ -1,86 +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 . - */ -package org.hibernate.cfg; - -import java.util.Locale; - -import org.hibernate.AssertionFailure; -import org.hibernate.internal.util.StringHelper; - -/** - * @author Emmanuel Bernard - * - * @deprecated {@link NamingStrategy} itself has been deprecated - */ -@Deprecated -public class DefaultComponentSafeNamingStrategy extends PersistenceStandardNamingStrategy { - public static final NamingStrategy INSTANCE = new DefaultComponentSafeNamingStrategy(); - - protected static String addUnderscores(String name) { - return name.replace( '.', '_' ).toLowerCase(Locale.ROOT); - } - - @Override - public String propertyToColumnName(String propertyName) { - return addUnderscores( propertyName ); - } - - @Override - public String collectionTableName( - String ownerEntity, - String ownerEntityTable, - String associatedEntity, - String associatedEntityTable, - String propertyName) { - final String entityTableName = associatedEntityTable != null - ? associatedEntityTable - : addUnderscores(propertyName); - return tableName( ownerEntityTable + "_" + entityTableName ); - } - - - public String foreignKeyColumnName( - String propertyName, - String propertyEntityName, - String propertyTableName, - String referencedColumnName) { - String header = propertyName != null ? addUnderscores( propertyName ) : propertyTableName; - if ( header == null ) { - throw new AssertionFailure( "NamingStrategy not properly filled" ); - } - return columnName( header + "_" + referencedColumnName ); - } - - @Override - public String logicalColumnName(String columnName, String propertyName) { - return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName; - } - - @Override - public String logicalCollectionTableName( - String tableName, - String ownerEntityTable, - String associatedEntityTable, - String propertyName) { - if ( tableName != null ) { - return tableName; - } - else { - final String entityTableName = associatedEntityTable != null ? associatedEntityTable : propertyName; - return ownerEntityTable + "_" + entityTableName; - } - - } - - @Override - public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) { - return StringHelper.isNotEmpty( columnName ) ? - columnName : - propertyName + "_" + referencedColumn; - } - -} diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/DefaultNamingStrategy.java b/hibernate-core/src/main/java/org/hibernate/cfg/DefaultNamingStrategy.java deleted file mode 100644 index 04b434dd0d..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cfg/DefaultNamingStrategy.java +++ /dev/null @@ -1,124 +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 . - */ -package org.hibernate.cfg; - -import java.io.Serializable; - -import org.hibernate.AssertionFailure; -import org.hibernate.internal.util.StringHelper; - -/** - * The default {@link NamingStrategy} - * - * @see ImprovedNamingStrategy a better alternative - * @author Gavin King - * - * @deprecated {@link NamingStrategy} itself has been deprecated - */ -@Deprecated -public class DefaultNamingStrategy implements NamingStrategy, Serializable { - - /** - * The singleton instance - */ - public static final NamingStrategy INSTANCE = new DefaultNamingStrategy(); - - /** - * Return the unqualified class name - */ - public String classToTableName(String className) { - return StringHelper.unqualify(className); - } - /** - * Return the unqualified property name - */ - public String propertyToColumnName(String propertyName) { - return StringHelper.unqualify(propertyName); - } - /** - * Return the argument - */ - public String tableName(String tableName) { - return tableName; - } - /** - * Return the argument - */ - public String columnName(String columnName) { - return columnName; - } - - /** - * Return the unqualified property name, not the best strategy but a backward compatible one - */ - public String collectionTableName( - String ownerEntity, - String ownerEntityTable, - String associatedEntity, - String associatedEntityTable, - String propertyName) { - //use a degenerated strategy for backward compatibility - return StringHelper.unqualify(propertyName); - } - - /** - * Return the argument - */ - public String joinKeyColumnName(String joinedColumn, String joinedTable) { - return columnName( joinedColumn ); - } - - /** - * Return the property name or propertyTableName - */ - public String foreignKeyColumnName( - String propertyName, - String propertyEntityName, - String propertyTableName, - String referencedColumnName) { - final String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName; - if (header == null) { - throw new AssertionFailure("NammingStrategy not properly filled"); - } - return columnName( header ); //+ "_" + referencedColumnName not used for backward compatibility - } - - /** - * Return the column name or the unqualified property name - */ - public String logicalColumnName(String columnName, String propertyName) { - return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName ); - } - - /** - * Returns either the table name if explicit or - * if there is an associated table, the concatenation of owner entity table and associated table - * otherwise the concatenation of owner entity table and the unqualified property name - */ - public String logicalCollectionTableName( - String tableName, - String ownerEntityTable, - String associatedEntityTable, - String propertyName) { - if ( tableName != null ) { - return tableName; - } - else { - final String entityTableName = associatedEntityTable != null - ? associatedEntityTable - : StringHelper.unqualify(propertyName); - return ownerEntityTable + "_" + entityTableName; - } - } - /** - * Return the column name if explicit or the concatenation of the property name and the referenced column - * - */ - public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) { - return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName + "_" + referencedColumn; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/ImprovedNamingStrategy.java b/hibernate-core/src/main/java/org/hibernate/cfg/ImprovedNamingStrategy.java deleted file mode 100644 index f7ac87a3e9..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cfg/ImprovedNamingStrategy.java +++ /dev/null @@ -1,136 +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 . - */ -package org.hibernate.cfg; - -import java.io.Serializable; -import java.util.Locale; - -import org.hibernate.AssertionFailure; -import org.hibernate.internal.util.StringHelper; - -/** - * An improved naming strategy that prefers embedded - * underscores to mixed case names - * - * @see DefaultNamingStrategy the default strategy - * @author Gavin King - * - * @deprecated {@link NamingStrategy} itself has been deprecated - */ -@Deprecated -public class ImprovedNamingStrategy implements NamingStrategy, Serializable { - - /** - * A convenient singleton instance - */ - public static final NamingStrategy INSTANCE = new ImprovedNamingStrategy(); - - /** - * Return the unqualified class name, mixed case converted to - * underscores - */ - public String classToTableName(String className) { - return addUnderscores( StringHelper.unqualify(className) ); - } - /** - * Return the full property path with underscore separators, mixed - * case converted to underscores - */ - public String propertyToColumnName(String propertyName) { - return addUnderscores( StringHelper.unqualify(propertyName) ); - } - /** - * Convert mixed case to underscores - */ - public String tableName(String tableName) { - return addUnderscores(tableName); - } - /** - * Convert mixed case to underscores - */ - public String columnName(String columnName) { - return addUnderscores(columnName); - } - - protected static String addUnderscores(String name) { - StringBuilder buf = new StringBuilder( name.replace('.', '_') ); - for (int i=1; i. - */ -package org.hibernate.cfg; - - -/** - * A set of rules for determining the physical column - * and table names given the information in the mapping - * document. May be used to implement project-scoped - * naming standards for database objects. - * - * @see DefaultNamingStrategy - * @see ImprovedNamingStrategy - * @author Gavin King - * @author Emmanuel Bernard - * - * @deprecated {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy} - * and {@link org.hibernate.boot.model.naming.PhysicalNamingStrategy} should - * be used instead. - */ -@Deprecated(since = "6", forRemoval = true) -public interface NamingStrategy { - /** - * Return a table name for an entity class - * @param className the fully-qualified class name - * @return a table name - */ - String classToTableName(String className); - /** - * Return a column name for a property path expression - * @param propertyName a property path - * @return a column name - */ - String propertyToColumnName(String propertyName); - /** - * Alter the table name given in the mapping document - * @param tableName a table name - * @return a table name - */ - String tableName(String tableName); - /** - * Alter the column name given in the mapping document - * @param columnName a column name - * @return a column name - */ - String columnName(String columnName); - /** - * Return a collection table name ie an association having a join table - * - * @param ownerEntity - * @param ownerEntityTable owner side table name - * @param associatedEntity - * @param associatedEntityTable reverse side table name if any - * @param propertyName collection role - */ - String collectionTableName( - String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable, - String propertyName - ); - /** - * Return the join key column name ie a FK column used in a JOINED strategy or for a secondary table - * - * @param joinedColumn joined column name (logical one) used to join with - * @param joinedTable joined table name (ie the referenced table) used to join with - */ - String joinKeyColumnName(String joinedColumn, String joinedTable); - /** - * Return the foreign key column name for the given parameters - * @param propertyName the property name involved - * @param propertyEntityName - * @param propertyTableName the property table name involved (logical one) - * @param referencedColumnName the referenced column name involved (logical one) - */ - String foreignKeyColumnName( - String propertyName, String propertyEntityName, String propertyTableName, String referencedColumnName - ); - /** - * Return the logical column name used to refer to a column in the metadata - * (like index, unique constraints etc) - * A full bijection is required between logicalNames and physical ones - * logicalName have to be case insensitively unique for a given table - * - * @param columnName given column name if any - * @param propertyName property name of this column - */ - String logicalColumnName(String columnName, String propertyName); - /** - * Returns the logical collection table name used to refer to a table in the mapping metadata - * - * @param tableName the metadata explicit name - * @param ownerEntityTable owner table entity table name (logical one) - * @param associatedEntityTable reverse side table name if any (logical one) - * @param propertyName collection role - */ - String logicalCollectionTableName(String tableName, String ownerEntityTable, String associatedEntityTable, String propertyName); - - /** - * Returns the logical foreign key column name used to refer to this column in the mapping metadata - * - * @param columnName given column name in the metadata if any - * @param propertyName property name - * @param referencedColumn referenced column name (logical one) in the join - */ - String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn); -} diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/PersistenceStandardNamingStrategy.java b/hibernate-core/src/main/java/org/hibernate/cfg/PersistenceStandardNamingStrategy.java deleted file mode 100644 index 92da08c05e..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cfg/PersistenceStandardNamingStrategy.java +++ /dev/null @@ -1,90 +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 . - */ -package org.hibernate.cfg; -import java.io.Serializable; - -import org.hibernate.AssertionFailure; -import org.hibernate.internal.util.StringHelper; - -/** - * Naming strategy implementing the EJB3 standards - * - * @author Emmanuel Bernard - * - * @deprecated {@link NamingStrategy} itself has been deprecated - */ -@Deprecated -public class PersistenceStandardNamingStrategy implements NamingStrategy, Serializable { - public static final NamingStrategy INSTANCE = new PersistenceStandardNamingStrategy(); - - public String classToTableName(String className) { - return StringHelper.unqualify( className ); - } - - public String propertyToColumnName(String propertyName) { - return StringHelper.unqualify( propertyName ); - } - - public String tableName(String tableName) { - return tableName; - } - - public String columnName(String columnName) { - return columnName; - } - - public String collectionTableName( - String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable, - String propertyName - ) { - String entityTableName = associatedEntityTable != null - ? associatedEntityTable - : StringHelper.unqualify(propertyName); - return tableName( ownerEntityTable + "_" + entityTableName ); - } - - public String joinKeyColumnName(String joinedColumn, String joinedTable) { - return columnName( joinedColumn ); - } - - public String foreignKeyColumnName( - String propertyName, - String propertyEntityName, - String propertyTableName, - String referencedColumnName) { - String header = propertyName != null ? StringHelper.unqualify( propertyName ) : propertyTableName; - if ( header == null ) { - throw new AssertionFailure( "NamingStrategy not properly filled" ); - } - return columnName( header + "_" + referencedColumnName ); - } - - public String logicalColumnName(String columnName, String propertyName) { - return StringHelper.isNotEmpty( columnName ) ? columnName : StringHelper.unqualify( propertyName ); - } - - public String logicalCollectionTableName( - String tableName, - String ownerEntityTable, String associatedEntityTable, String propertyName - ) { - if ( tableName != null ) { - return tableName; - } - else { - String entityTableName = associatedEntityTable != null - ? associatedEntityTable - : StringHelper.unqualify(propertyName); - return ownerEntityTable + "_" + entityTableName; - } - } - - public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) { - return StringHelper.isNotEmpty( columnName ) ? - columnName : - StringHelper.unqualify( propertyName ) + "_" + referencedColumn; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/SecondPass.java b/hibernate-core/src/main/java/org/hibernate/cfg/SecondPass.java deleted file mode 100644 index 3b0b013093..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/cfg/SecondPass.java +++ /dev/null @@ -1,20 +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.cfg; - -/** - * Hibernate builds its {@linkplain org.hibernate.mapping build-time model} - * incrementally, often delaying operations until other pieces of information - * are available. A second pass represents one of these delayed operations. - * - * @author Emmanuel Bernard - * - * @deprecated Use {@link org.hibernate.boot.spi.SecondPass} instead - */ -@Deprecated(since = "6", forRemoval = true) -public interface SecondPass extends org.hibernate.boot.spi.SecondPass { -} diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java index be6f131f9e..495cac58e9 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractHANADialect.java @@ -352,14 +352,6 @@ public abstract class AbstractHANADialect extends Dialect { return false; } - /** - * @deprecated Use {@link HANAServerConfiguration#fromDialectResolutionInfo(DialectResolutionInfo)} instead - */ - @Deprecated(forRemoval = true) - protected static DatabaseVersion createVersion(DialectResolutionInfo info) { - return HANAServerConfiguration.fromDialectResolutionInfo( info ).getFullVersion(); - } - @Override public String castPattern(CastType from, CastType to) { if ( to == CastType.BOOLEAN ) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java index 60f2e89b1a..43fa656d78 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/AbstractTransactSQLDialect.java @@ -172,14 +172,6 @@ public abstract class AbstractTransactSQLDialect extends Dialect { return replaceLtrimRtrim( specification, isWhitespace ); } - /** - * @deprecated Use {@link #replaceLtrimRtrim(TrimSpec, boolean)} instead. - */ - @Deprecated( forRemoval = true ) - public static String replaceLtrimRtrim(TrimSpec specification, char character) { - return replaceLtrimRtrim( specification, character == ' ' ); - } - public static String replaceLtrimRtrim(TrimSpec specification, boolean isWhitespace) { switch ( specification ) { case LEADING: diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index b4bdfff5ea..2ff5231767 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -1537,22 +1537,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun return "cast(?1 as ?2)"; } - /** - * Obtain a pattern for the SQL equivalent to a - * {@code trim()} function call. The resulting - * pattern must contain a ?1 placeholder for the - * argument of type {@link String}. - * - * @param specification {@code leading} or {@code trailing} - * @param character the character to trim - * - * @deprecated Use {@link #trimPattern(TrimSpec, boolean)} instead. - */ - @Deprecated( forRemoval = true ) - public String trimPattern(TrimSpec specification, char character) { - return trimPattern( specification, character == ' ' ); - } - /** * Obtain a pattern for the SQL equivalent to a * {@code trim()} function call. The resulting @@ -2041,28 +2025,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun return true; } - /** - * If this dialect supports specifying lock timeouts, are those timeouts - * rendered into the {@code SQL} string as parameters? The implication - * is that Hibernate will need to bind the timeout value as a parameter - * in the {@link PreparedStatement}. If true, the parameter position - * is always handled as the last parameter; if the dialect specifies the - * lock timeout elsewhere in the {@code SQL} statement then the timeout - * value should be directly rendered into the statement and this method - * should return false. - * - * @return True if the lock timeout is rendered into the {@code SQL} - * string as a parameter; false otherwise. - * - * @deprecated This is never called, and since at least Hibernate 5 has - * just returned {@code false} in every dialect. It will be - * removed. - */ - @Deprecated(since = "6", forRemoval = true) - public boolean isLockTimeoutParameterized() { - return false; - } - /** * A {@link LockingStrategy} which is able to acquire a database-level * lock with the specified {@linkplain LockMode level}. @@ -3724,22 +3686,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun return !useInputStreamToInsertBlob(); } - /** - * Does this dialect support parameters within the {@code SELECT} clause - * of {@code INSERT ... SELECT ...} statements? - * - * @return True if this is supported; false otherwise. - * - * @since 3.2 - * - * @deprecated This seems to be supported on all platforms, and we don't - * call this except in test suite - */ - @Deprecated(since = "6", forRemoval = true) - public boolean supportsParametersInInsertSelect() { - return true; - } - /** * Does this dialect support references to result variables * (i.e, select items) by column positions (1-origin) as defined @@ -4636,16 +4582,6 @@ public abstract class Dialect implements ConversionContext, TypeContributor, Fun return supportsNoWait(); } - /** - * @deprecated This is no longer called - */ - @Deprecated(since = "6", forRemoval = true) - public String inlineLiteral(String literal) { - final StringBuilder sb = new StringBuilder( literal.length() + 2 ); - appendLiteral( new StringBuilderSqlAppender( sb ), literal ); - return sb.toString(); - } - /** * Append a literal string to the given {@link SqlAppender}. * diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/DialectDelegateWrapper.java b/hibernate-core/src/main/java/org/hibernate/dialect/DialectDelegateWrapper.java index e048ad1d6a..ab804fe1d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/DialectDelegateWrapper.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/DialectDelegateWrapper.java @@ -285,11 +285,6 @@ public class DialectDelegateWrapper extends Dialect { return wrapped.castPattern( from, to ); } - @Override - public String trimPattern(TrimSpec specification, char character) { - return wrapped.trimPattern( specification, character ); - } - @Override public String trimPattern(TrimSpec specification, boolean isWhitespace) { return wrapped.trimPattern( specification, isWhitespace ); @@ -405,12 +400,6 @@ public class DialectDelegateWrapper extends Dialect { return wrapped.supportsLockTimeouts(); } - @Override - @Deprecated(since = "6", forRemoval = true) - public boolean isLockTimeoutParameterized() { - return wrapped.isLockTimeoutParameterized(); - } - @Override public LockingStrategy getLockingStrategy(Lockable lockable, LockMode lockMode) { return wrapped.getLockingStrategy( lockable, lockMode ); @@ -1046,12 +1035,6 @@ public class DialectDelegateWrapper extends Dialect { return wrapped.useConnectionToCreateLob(); } - @Override - @Deprecated(since = "6", forRemoval = true) - public boolean supportsParametersInInsertSelect() { - return wrapped.supportsParametersInInsertSelect(); - } - @Override public boolean supportsOrdinalSelectItemReference() { return wrapped.supportsOrdinalSelectItemReference(); @@ -1367,12 +1350,6 @@ public class DialectDelegateWrapper extends Dialect { return wrapped.supportsWait(); } - @Override - @Deprecated(since = "6", forRemoval = true) - public String inlineLiteral(String literal) { - return wrapped.inlineLiteral( literal ); - } - @Override public void appendLiteral(SqlAppender appender, String literal) { wrapped.appendLiteral( appender, literal ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLEnumJdbcType.java b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLEnumJdbcType.java deleted file mode 100644 index a5d752ac5d..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLEnumJdbcType.java +++ /dev/null @@ -1,25 +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 . - */ -package org.hibernate.dialect; - -import org.hibernate.type.descriptor.jdbc.EnumJdbcType; - -/** - * Represents an {@code enum} type on MySQL. - *

- * Hibernate will automatically use this for enums mapped - * as {@link jakarta.persistence.EnumType#STRING}. - * - * @see org.hibernate.type.SqlTypes#ENUM - * @see MySQLDialect#getEnumTypeDeclaration(String, String[]) - * @deprecated Use {@link EnumJdbcType} instead - * - * @author Gavin King - */ -@Deprecated(forRemoval = true) -public class MySQLEnumJdbcType extends EnumJdbcType { -} diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLSqlAstTranslator.java b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLSqlAstTranslator.java index 6be62a55c4..44256d3a9c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/MySQLSqlAstTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/MySQLSqlAstTranslator.java @@ -52,14 +52,6 @@ public class MySQLSqlAstTranslator extends AbstractSqlA super( sessionFactory, statement ); } - /** - * @deprecated Use {@link #getSqlType(CastTarget, SessionFactoryImplementor)} instead - */ - @Deprecated(forRemoval = true) - public static String getSqlType(CastTarget castTarget, Dialect dialect) { - return getSqlType( castTarget, castTarget.getSqlType(), dialect ); - } - public static String getSqlType(CastTarget castTarget, SessionFactoryImplementor factory) { final String sqlType = getCastTypeName( castTarget, factory.getTypeConfiguration() ); return getSqlType( castTarget, sqlType, factory.getJdbcServices().getDialect() ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java index 67fa1ce56a..4562863592 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/PostgreSQLDialect.java @@ -547,46 +547,6 @@ public class PostgreSQLDialect extends Dialect { } } - /** - * @deprecated No longer used, and should be removed - */ - @Deprecated(forRemoval = true) - protected void extractField( - StringBuilder pattern, - TemporalUnit unit, - TemporalType fromTimestamp, - TemporalType toTimestamp, - TemporalUnit toUnit) { - pattern.append( "extract(" ); - pattern.append( translateDurationField( unit ) ); - pattern.append( " from " ); - if ( toTimestamp == TemporalType.DATE && fromTimestamp == TemporalType.DATE ) { - // special case subtraction of two - // dates results in an integer not - // an Interval - pattern.append( "age(?3,?2)" ); - } - else { - switch ( unit ) { - case YEAR: - case MONTH: - case QUARTER: - pattern.append( "age(?3,?2)" ); - break; - case DAY: - case HOUR: - case MINUTE: - case SECOND: - case EPOCH: - pattern.append( "?3-?2" ); - break; - default: - throw new SemanticException( unit + " is not a legal field" ); - } - } - pattern.append( ")" ).append( unit.conversionFactor( toUnit, this ) ); - } - @Override public TimeZoneSupport getTimeZoneSupport() { return TimeZoneSupport.NORMALIZE; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/function/FormatFunction.java b/hibernate-core/src/main/java/org/hibernate/dialect/function/FormatFunction.java index 8cce3717cf..7f57d055e7 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/function/FormatFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/function/FormatFunction.java @@ -19,7 +19,6 @@ import org.hibernate.query.sqm.TemporalUnit; import org.hibernate.query.sqm.function.AbstractSqmFunctionDescriptor; import org.hibernate.query.sqm.function.AbstractSqmSelfRenderingFunctionDescriptor; import org.hibernate.query.sqm.function.FunctionRenderer; -import org.hibernate.query.sqm.function.FunctionRenderingSupport; import org.hibernate.query.sqm.function.MultipatternSqmFunctionDescriptor; import org.hibernate.query.sqm.function.SelfRenderingFunctionSqlAstExpression; import org.hibernate.query.sqm.function.SelfRenderingSqmFunction; @@ -174,33 +173,6 @@ public class FormatFunction extends AbstractSqmFunctionDescriptor implements Fun private final boolean supportsPatternLiterals; private final TypeConfiguration typeConfiguration; - /** - * @deprecated Use {@link #FormatSqmFunction(SqmFunctionDescriptor, FunctionRenderer, List, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, boolean, QueryEngine)} instead - */ - @Deprecated(forRemoval = true) - public FormatSqmFunction( - SqmFunctionDescriptor descriptor, - FunctionRenderingSupport renderingSupport, - List> arguments, - ReturnableType impliedResultType, - ArgumentsValidator argumentsValidator, - FunctionReturnTypeResolver returnTypeResolver, - boolean supportsPatternLiterals, - QueryEngine queryEngine) { - super( - descriptor, - renderingSupport, - arguments, - impliedResultType, - argumentsValidator, - returnTypeResolver, - queryEngine.getCriteriaBuilder(), - "format" - ); - this.supportsPatternLiterals = supportsPatternLiterals; - this.typeConfiguration = queryEngine.getTypeConfiguration(); - } - public FormatSqmFunction( SqmFunctionDescriptor descriptor, FunctionRenderer renderer, diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/identity/Oracle12cGetGeneratedKeysDelegate.java b/hibernate-core/src/main/java/org/hibernate/dialect/identity/Oracle12cGetGeneratedKeysDelegate.java deleted file mode 100644 index 43b63977f7..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/dialect/identity/Oracle12cGetGeneratedKeysDelegate.java +++ /dev/null @@ -1,34 +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 . - */ -package org.hibernate.dialect.identity; - -import org.hibernate.Remove; -import org.hibernate.dialect.Dialect; -import org.hibernate.generator.EventType; -import org.hibernate.id.PostInsertIdentityPersister; -import org.hibernate.id.insert.GetGeneratedKeysDelegate; -import org.hibernate.persister.entity.EntityPersister; - -/** - * @author Andrea Boriero - * - * @deprecated no longer used, use {@link GetGeneratedKeysDelegate} instead - */ -@Deprecated(forRemoval = true) @Remove -public class Oracle12cGetGeneratedKeysDelegate extends GetGeneratedKeysDelegate { - /** - * @deprecated Use {@link #Oracle12cGetGeneratedKeysDelegate(EntityPersister)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public Oracle12cGetGeneratedKeysDelegate(PostInsertIdentityPersister persister, Dialect dialect) { - this( persister ); - } - - public Oracle12cGetGeneratedKeysDelegate(EntityPersister persister) { - super( persister, false, EventType.INSERT ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java index 53e4c3ffb3..16a772b7d3 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/pagination/Oracle12LimitHandler.java @@ -48,14 +48,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { ); } - /** - * @deprecated Use {@link #processSql(String, boolean, boolean, LockOptions)} instead - */ - @Deprecated(forRemoval = true) - protected String processSql(String sql, boolean hasFirstRow, LockOptions lockOptions) { - return processSql( sql, hasFirstRow, true, lockOptions ); - } - protected String processSql(String sql, boolean hasFirstRow, boolean hasMaxRows, LockOptions lockOptions) { if ( lockOptions != null ) { final LockMode lockMode = lockOptions.getLockMode(); @@ -75,14 +67,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { return processSqlOffsetFetch( sql, hasFirstRow, hasMaxRows ); } - /** - * @deprecated Use {@link #processSqlOffsetFetch(String, boolean, boolean)} instead - */ - @Deprecated(forRemoval = true) - protected String processSqlOffsetFetch(String sql, boolean hasFirstRow) { - return processSqlOffsetFetch( sql, hasFirstRow, true ); - } - protected String processSqlOffsetFetch(String sql, boolean hasFirstRow, boolean hasMaxRows) { final int forUpdateLastIndex = getForUpdateIndex( sql ); @@ -109,14 +93,6 @@ public class Oracle12LimitHandler extends AbstractLimitHandler { return insertAtEnd(offsetFetchString, sql); } - /** - * @deprecated Use {@link #processSql(String, int, boolean, boolean)} instead - */ - @Deprecated(forRemoval = true) - protected String processSql(String sql, int forUpdateIndex, boolean hasFirstRow) { - return processSql( sql, forUpdateIndex, hasFirstRow, true ); - } - protected String processSql(String sql, int forUpdateIndex, boolean hasFirstRow, boolean hasMaxRows) { bindLimitParametersInReverseOrder = true; useMaxForLimit = true; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/sequence/OracleSequenceSupport.java b/hibernate-core/src/main/java/org/hibernate/dialect/sequence/OracleSequenceSupport.java index 3b512341f7..eb9095c373 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/sequence/OracleSequenceSupport.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/sequence/OracleSequenceSupport.java @@ -19,11 +19,6 @@ import org.hibernate.dialect.Dialect; * @see Oracle Database Documentation */ public final class OracleSequenceSupport extends NextvalSequenceSupport { - /** - * @deprecated Construct instance based on version instead. - */ - @Deprecated(forRemoval = true) - public static final SequenceSupport INSTANCE = new OracleSequenceSupport( true, false ); public static SequenceSupport getInstance(final Dialect dialect) { return new OracleSequenceSupport(dialect.getVersion()); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java index e7840c9d94..02f0f22d6c 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java @@ -221,7 +221,8 @@ public class TemporaryTable implements Exportable, Contributable { .getEntityBinding( pluralAttribute.findContainingEntityMapping().getEntityName() ); final Property property = findPropertyByName( declaringClass, attributeName ); assert property != null; - final Iterator columnIterator = ( (Collection) property.getValue() ).getKey().getSelectables().iterator(); + final Collection collection = (Collection) property.getValue(); + final Iterator columnIterator = collection.getKey().getSelectables().iterator(); fkTarget.forEachSelectable( (columnIndex, selection) -> { final Selectable selectable = columnIterator.next(); @@ -401,7 +402,7 @@ public class TemporaryTable implements Exportable, Contributable { final PersistentClass declaringClass = runtimeModelCreationContext.getBootModel() .getEntityBinding( attribute.findContainingEntityMapping().getEntityName() ); final SimpleValue value = (SimpleValue) declaringClass.getProperty( attribute.getAttributeName() ).getValue(); - final Iterator columnIterator = value.getConstraintColumnIterator(); + final Iterator columnIterator = value.getVirtualSelectables().iterator(); attribute.forEachSelectable( (columnIndex, selection) -> { final Selectable selectable = columnIterator.next(); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/unique/DefaultUniqueDelegate.java b/hibernate-core/src/main/java/org/hibernate/dialect/unique/DefaultUniqueDelegate.java index 6a107eb5c2..85142a12ae 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/unique/DefaultUniqueDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/unique/DefaultUniqueDelegate.java @@ -11,7 +11,7 @@ import org.hibernate.dialect.Dialect; /** * @deprecated use {@link org.hibernate.dialect.unique.AlterTableUniqueDelegate} */ -@Deprecated(since="6.2") +@Deprecated(since="6.2", forRemoval = true) public class DefaultUniqueDelegate extends AlterTableUniqueDelegate { public DefaultUniqueDelegate(Dialect dialect) { super(dialect); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/OptimisticLockStyle.java b/hibernate-core/src/main/java/org/hibernate/engine/OptimisticLockStyle.java index cb0310eee1..527bc126dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/OptimisticLockStyle.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/OptimisticLockStyle.java @@ -6,7 +6,6 @@ */ package org.hibernate.engine; -import org.hibernate.AssertionFailure; import org.hibernate.annotations.OptimisticLockType; /** @@ -65,51 +64,4 @@ public enum OptimisticLockStyle { public boolean isNone() { return this == NONE; } - - /** - * @deprecated these integer codes have not been used for a long time - */ - @Deprecated(since = "6.2", forRemoval = true) - public int getOldCode() { - switch (this) { - case NONE: - return -1; - case VERSION: - return 0; - case DIRTY: - return 1; - case ALL: - return 2; - default: - throw new AssertionFailure("Unknown OptimisticLockStyle"); - } - } - - /** - * Given an old code (one of the int constants from Cascade), - * interpret it as one of the new enums. - * - * @param oldCode The old int constant code - * - * @return The interpreted enum value - * - * @throws IllegalArgumentException If the code did not match any legacy constant. - * - * @deprecated these integer codes have not been used for a long time - */ - @Deprecated(since = "6.2", forRemoval = true) - public static OptimisticLockStyle interpretOldCode(int oldCode) { - switch ( oldCode ) { - case -1: - return NONE; - case 0: - return VERSION; - case 1: - return DIRTY; - case 2: - return ALL; - default: - throw new IllegalArgumentException( "Illegal legacy optimistic lock style code : " + oldCode ); - } - } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java index 7038b1aa9f..ddf610f60e 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/env/internal/JdbcEnvironmentInitiator.java @@ -14,6 +14,7 @@ import java.util.Map; import java.util.StringTokenizer; import org.hibernate.boot.registry.StandardServiceInitiator; +import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.JdbcSettings; import org.hibernate.dialect.DatabaseVersion; import org.hibernate.dialect.Dialect; @@ -89,7 +90,8 @@ public class JdbcEnvironmentInitiator implements StandardServiceInitiator. - */ -package org.hibernate.engine.query.spi; - -import org.hibernate.graph.GraphSemantic; -import org.hibernate.graph.spi.AppliedGraph; -import org.hibernate.graph.spi.RootGraphImplementor; - -import org.checkerframework.checker.nullness.qual.Nullable; - -/** - * Encapsulates a JPA EntityGraph provided through a JPQL query hint. Converts the fetches into a list of AST - * FromElements. The logic is kept here as much as possible in order to make it easy to remove this in the future, - * once our AST is improved and this "hack" is no longer needed. - * - * @author Brett Meyer - * - * @deprecated use {@link AppliedGraph} instead - */ -@Deprecated(since = "6.0") -public class EntityGraphQueryHint implements AppliedGraph { - private final AppliedGraph delegate; - - public EntityGraphQueryHint(AppliedGraph delegate) { - this.delegate = delegate; - } - - @Override - public @Nullable GraphSemantic getSemantic() { - return delegate.getSemantic(); - } - - @Override - public @Nullable RootGraphImplementor getGraph() { - return delegate.getGraph(); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/ParamLocationRecognizer.java b/hibernate-core/src/main/java/org/hibernate/engine/query/spi/ParamLocationRecognizer.java deleted file mode 100644 index 58b2f08177..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/engine/query/spi/ParamLocationRecognizer.java +++ /dev/null @@ -1,245 +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 . - */ -package org.hibernate.engine.query.spi; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.hibernate.engine.query.ParameterRecognitionException; -import org.hibernate.internal.util.collections.ArrayHelper; -import org.hibernate.query.sql.spi.ParameterRecognizer; - -/** - * Implements a parameter parser recognizer specifically for the purpose - * of journaling parameter locations. - * - * @author Steve Ebersole - * @deprecated No longer used - */ -@Deprecated(since = "6.4", forRemoval = true) -public class ParamLocationRecognizer implements ParameterRecognizer { - - private Map> namedParameterDescriptors; - private Map> ordinalParameterDescriptors; - - private Map inFlightNamedStateMap; - private Map inFlightOrdinalStateMap; - private Map inFlightJpaOrdinalStateMap; - - private final int jdbcStyleOrdinalCountBase; - private int jdbcStyleOrdinalCount; - - public ParamLocationRecognizer(int jdbcStyleOrdinalCountBase) { - this.jdbcStyleOrdinalCountBase = jdbcStyleOrdinalCountBase; - this.jdbcStyleOrdinalCount = jdbcStyleOrdinalCountBase; - } - -// /** -// * Convenience method for creating a param location recognizer and -// * initiating the parse. -// */ -// public static ParamLocationRecognizer parseLocations( -// String query, -// SessionFactoryImplementor sessionFactory) { -// final ParamLocationRecognizer recognizer = new ParamLocationRecognizer( 1 ); -// ParameterParser.parse( query, recognizer ); -// return recognizer; -// } - - public void validate() { - if ( inFlightNamedStateMap != null && ( inFlightOrdinalStateMap != null || inFlightJpaOrdinalStateMap != null ) ) { - throw mixedParamStrategy(); - } - - // we know `inFlightNamedStateMap` is null, so no need to check it again - - if ( inFlightOrdinalStateMap != null && inFlightJpaOrdinalStateMap != null ) { - throw mixedParamStrategy(); - } - - if ( inFlightNamedStateMap != null ) { - final Map> tmp = new HashMap<>(); - for ( InFlightNamedParameterState inFlightState : inFlightNamedStateMap.values() ) { - tmp.put( inFlightState.name, inFlightState.complete() ); - } - namedParameterDescriptors = Collections.unmodifiableMap( tmp ); - } - else { - namedParameterDescriptors = Collections.emptyMap(); - } - - if ( inFlightOrdinalStateMap == null && inFlightJpaOrdinalStateMap == null ) { - ordinalParameterDescriptors = Collections.emptyMap(); - } - else { - final Map> tmp = new HashMap<>(); - if ( inFlightOrdinalStateMap != null ) { - for ( InFlightOrdinalParameterState state : inFlightOrdinalStateMap.values() ) { - tmp.put( state.identifier, state.complete() ); - } - } - else { - for ( InFlightJpaOrdinalParameterState state : inFlightJpaOrdinalStateMap.values() ) { - tmp.put( state.identifier, state.complete() ); - } - } - ordinalParameterDescriptors = Collections.unmodifiableMap( tmp ); - } - } - - private ParameterRecognitionException mixedParamStrategy() { - throw new ParameterRecognitionException( "Mixed parameter strategies - use just one of named, positional or JPA-ordinal strategy" ); - } - - public Map> getNamedParameterDescriptionMap() { - return namedParameterDescriptors; - } - - public Map> getOrdinalParameterDescriptionMap() { - return ordinalParameterDescriptors; - } - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Recognition code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - - // NOTE : we keep track of `inFlightOrdinalStateMap` versus `inFlightJpaOrdinalStateMap` - // in order to perform better validations of mixed parameter strategies - - @Override - public void ordinalParameter(int position) { - if ( inFlightOrdinalStateMap == null ) { - inFlightOrdinalStateMap = new HashMap<>(); - } - - final int label = jdbcStyleOrdinalCount++; - inFlightOrdinalStateMap.put( - label, - new InFlightOrdinalParameterState( label, label - jdbcStyleOrdinalCountBase, position ) - ); - } - - @Override - public void namedParameter(String name, int position) { - getOrBuildNamedParameterDescription( name ).add( position ); - } - - private InFlightNamedParameterState getOrBuildNamedParameterDescription(String name) { - if ( inFlightNamedStateMap == null ) { - inFlightNamedStateMap = new HashMap<>(); - } - - InFlightNamedParameterState descriptor = inFlightNamedStateMap.get( name ); - if ( descriptor == null ) { - descriptor = new InFlightNamedParameterState( name ); - inFlightNamedStateMap.put( name, descriptor ); - } - return descriptor; - } - - @Override - public void jpaPositionalParameter(int name, int position) { - getOrBuildJpaOrdinalParameterDescription( name ).add( position ); - } - - private InFlightJpaOrdinalParameterState getOrBuildJpaOrdinalParameterDescription(int name) { - if ( inFlightJpaOrdinalStateMap == null ) { - inFlightJpaOrdinalStateMap = new HashMap<>(); - } - - InFlightJpaOrdinalParameterState descriptor = inFlightJpaOrdinalStateMap.get( name ); - if ( descriptor == null ) { - descriptor = new InFlightJpaOrdinalParameterState( name ); - inFlightJpaOrdinalStateMap.put( name, descriptor ); - } - return descriptor; - } - - @Override - public void other(char character) { - // don't care... - } - - /** - * Internal in-flight representation of a recognized named parameter - */ - public static class InFlightNamedParameterState { - private final String name; - private final List sourcePositions = new ArrayList<>(); - - InFlightNamedParameterState(String name) { - this.name = name; - } - - private void add(int position) { - sourcePositions.add( position ); - } - - private NamedParameterDescriptor complete() { - return new NamedParameterDescriptor<>( - name, - null, - ArrayHelper.toIntArray( sourcePositions ) - ); - } - } - - - /** - * Internal in-flight representation of a recognized named parameter - */ - public static class InFlightOrdinalParameterState { - private final int identifier; - private final int valuePosition; - private final int sourcePosition; - - InFlightOrdinalParameterState(int label, int valuePosition, int sourcePosition) { - this.identifier = label; - this.valuePosition = valuePosition; - this.sourcePosition = sourcePosition; - } - - private OrdinalParameterDescriptor complete() { - return new OrdinalParameterDescriptor<>( - identifier, - valuePosition, - null, - new int[] { sourcePosition } - ); - } - } - - - /** - * Internal in-flight representation of a recognized named parameter - */ - public static class InFlightJpaOrdinalParameterState { - private final int identifier; - private final List sourcePositions = new ArrayList<>(); - - InFlightJpaOrdinalParameterState(int identifier) { - this.identifier = identifier; - } - - private void add(int position) { - sourcePositions.add( position ); - } - - private OrdinalParameterDescriptor complete() { - return new OrdinalParameterDescriptor<>( - identifier, - identifier - 1, - null, - ArrayHelper.toIntArray( sourcePositions ) - ); - } - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/ExecuteUpdateResultCheckStyle.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/ExecuteUpdateResultCheckStyle.java index 0d95cb386a..1c93ca67f0 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/ExecuteUpdateResultCheckStyle.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/ExecuteUpdateResultCheckStyle.java @@ -88,10 +88,6 @@ public enum ExecuteUpdateResultCheckStyle { return null; } - public static ExecuteUpdateResultCheckStyle determineDefault(@Nullable String customSql, boolean callable) { - return customSql != null && callable ? PARAM : COUNT; - } - public static @Nullable Supplier expectationConstructor( @Nullable ExecuteUpdateResultCheckStyle style) { return style == null ? null : style.expectationConstructor(); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java index 3721d004e1..f2e27b008c 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java @@ -310,11 +310,6 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getFastSessionServices(); } - @Override @Deprecated - public DeserializationResolver getDeserializationResolver() { - return delegate.getDeserializationResolver(); - } - @Override public Type getIdentifierType(String className) throws MappingException { return delegate.getIdentifierType( className ); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java index e0a06592f7..b7e7c9586d 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java @@ -212,12 +212,6 @@ public interface SessionFactoryImplementor T resolve(); } - /** - * @deprecated this is never called - */ - @Deprecated(since = "6.2", forRemoval = true) - DeserializationResolver getDeserializationResolver(); - /** * @deprecated no longer for internal use, use {@link #getMappingMetamodel()} or {@link #getJpaMetamodel()} */ diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java index 1622f78dd9..b8e99f5604 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SharedSessionContractImplementor.java @@ -544,25 +544,6 @@ public interface SharedSessionContractImplementor default void autoPreFlush(){ } - /** - * Are we currently enforcing a {@linkplain GraphSemantic#FETCH fetch graph}? - * - * @deprecated this is not used anywhere - */ - @Deprecated(since = "6", forRemoval = true) - default boolean isEnforcingFetchGraph() { - return false; - } - - /** - * Enable or disable {@linkplain GraphSemantic#FETCH fetch graph} enforcement. - * - * @deprecated this is not used anywhere - */ - @Deprecated(since = "6", forRemoval = true) - default void setEnforcingFetchGraph(boolean enforcingFetchGraph) { - } - /** * Check if there is a Hibernate or JTA transaction in progress and, * if there is not, flush if necessary, making sure that the connection diff --git a/hibernate-core/src/main/java/org/hibernate/id/IdentifierGenerator.java b/hibernate-core/src/main/java/org/hibernate/id/IdentifierGenerator.java index 72c6f5b78b..c16c5d5214 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/IdentifierGenerator.java +++ b/hibernate-core/src/main/java/org/hibernate/id/IdentifierGenerator.java @@ -140,16 +140,4 @@ public interface IdentifierGenerator extends BeforeExecutionGenerator, Exportabl default EnumSet getEventTypes() { return INSERT_ONLY; } - - /** - * Check if JDBC batch inserts are supported. - * - * @return JDBC batch inserts are supported. - * - * @deprecated this method is no longer called - */ - @Deprecated(since="6.2", forRemoval = true) - default boolean supportsJdbcBatchInserts() { - return true; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java b/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java index 3179f3d575..f4ab6af5ed 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/id/IdentifierGeneratorHelper.java @@ -12,28 +12,19 @@ import java.math.BigInteger; import java.math.RoundingMode; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.Objects; -import org.hibernate.HibernateException; import org.hibernate.Internal; import org.hibernate.TransientObjectException; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SharedSessionContractImplementor; -import org.hibernate.generator.values.internal.GeneratedValuesHelper; import org.hibernate.internal.CoreLogging; import org.hibernate.internal.CoreMessageLogger; -import org.hibernate.metamodel.mapping.JdbcMapping; -import org.hibernate.metamodel.mapping.SqlTypedMapping; -import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.type.EntityType; import org.hibernate.type.Type; -import org.hibernate.type.descriptor.WrapperOptions; import static org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved; -import static org.hibernate.internal.util.StringHelper.unquote; import static org.hibernate.spi.NavigablePath.IDENTIFIER_MAPPER_PROPERTY; /** @@ -62,71 +53,6 @@ public final class IdentifierGeneratorHelper { } }; - /** - * Marker object returned from {@link IdentifierGenerator#generate} to indicate that the entity's - * identifier will be generated as part of the database insertion. - * - * @deprecated Use a {@link org.hibernate.generator.OnExecutionGenerator} - */ - @Deprecated(forRemoval = true, since = "6.2") - public static final Serializable POST_INSERT_INDICATOR = new Serializable() { - @Override - public String toString() { - return "POST_INSERT_INDICATOR"; - } - }; - - /** - * Get the generated identifier when using identity columns - * - * @param path The {@link NavigableRole#getFullPath()} - * @param resultSet The result set from which to extract the generated identity - * @param wrapperOptions The session - * @return The generated identity value - * @throws SQLException Can be thrown while accessing the result set - * @throws HibernateException Indicates a problem reading back a generated identity value. - * - * @deprecated Use {@link GeneratedValuesHelper#getGeneratedValues} instead - */ - @Deprecated( since = "6.5", forRemoval = true ) - public static Object getGeneratedIdentity( - String path, - ResultSet resultSet, - PostInsertIdentityPersister persister, - WrapperOptions wrapperOptions) throws SQLException { - if ( !resultSet.next() ) { - throw new HibernateException( "The database returned no natively generated identity value : " + path ); - } - - JdbcMapping identifierType = ( (SqlTypedMapping) persister.getIdentifierMapping() ).getJdbcMapping(); - Object id = identifierType.getJdbcValueExtractor() - .extract( resultSet, columnIndex( resultSet, persister ), wrapperOptions ); - LOG.debugf( "Natively generated identity (%s) : %s", path, id ); - return id; - } - - private static int columnIndex(ResultSet resultSet, PostInsertIdentityPersister persister) { - try { - ResultSetMetaData metaData = resultSet.getMetaData(); - String keyColumnName = persister.getRootTableKeyColumnNames()[0]; - Dialect dialect = persister.getFactory().getJdbcServices().getDialect(); - for ( int i = 1 ; i<=metaData.getColumnCount(); i++ ) { - if ( equal( keyColumnName, metaData.getColumnName(i), dialect ) ) { - return i; - } - } - } - catch (SQLException e) { - LOG.debugf( "Could not determine column index from JDBC metadata", e ); - } - return 1; - } - - private static boolean equal(String keyColumnName, String alias, Dialect dialect) { - return alias.equalsIgnoreCase( keyColumnName ) - || alias.equalsIgnoreCase( unquote( keyColumnName, dialect ) ); - } - public static IntegralDataTypeHolder getIntegralDataTypeHolder(Class integralType) { if ( integralType == Long.class || integralType == Integer.class @@ -412,7 +338,7 @@ public final class IdentifierGeneratorHelper { @Override public int hashCode() { - return (int) ( value ^ ( value >>> 32 ) ); + return Long.hashCode(value); } } diff --git a/hibernate-core/src/main/java/org/hibernate/id/ResultSetIdentifierConsumer.java b/hibernate-core/src/main/java/org/hibernate/id/ResultSetIdentifierConsumer.java deleted file mode 100644 index 121234aee1..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/id/ResultSetIdentifierConsumer.java +++ /dev/null @@ -1,32 +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 . - */ -package org.hibernate.id; - -import java.sql.ResultSet; - -/** - * An optional contract for {@link org.hibernate.type.Type} or - * {@link org.hibernate.usertype.UserType} implementations to handle generated - * id values any way they see fit as opposed to being limited to the discrete set of - * numeric types handled by {@link IdentifierGeneratorHelper} - * - * @author Steve Ebersole - * - * @deprecated this interface is unnecessary and no longer used - */ -@Deprecated(since = "6.2", forRemoval = true) -public interface ResultSetIdentifierConsumer { - /** - * Given a result set, consume/extract the necessary values and construct an - * appropriate identifier value. - * - * @param resultSet The result set containing the value(s) to be used in building - * the identifier value. - * @return The identifier value. - */ - Object consumeIdentifier(ResultSet resultSet); -} diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractReturningDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractReturningDelegate.java index 1b39de5600..816c791093 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractReturningDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractReturningDelegate.java @@ -16,7 +16,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.generator.EventType; import org.hibernate.generator.values.AbstractGeneratedValuesMutationDelegate; import org.hibernate.generator.values.GeneratedValues; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.pretty.MessageHelper; @@ -30,13 +29,6 @@ import org.hibernate.pretty.MessageHelper; */ public abstract class AbstractReturningDelegate extends AbstractGeneratedValuesMutationDelegate implements InsertGeneratedIdentifierDelegate { - /** - * @deprecated Use {@link #AbstractReturningDelegate(EntityPersister, EventType, boolean, boolean)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public AbstractReturningDelegate(PostInsertIdentityPersister persister) { - super( persister, EventType.INSERT ); - } public AbstractReturningDelegate( EntityPersister persister, @@ -92,18 +84,6 @@ public abstract class AbstractReturningDelegate extends AbstractGeneratedValuesM } } - /** - * @deprecated No longer used - */ - @Deprecated( forRemoval = true, since = "6.5" ) - protected Object executeAndExtract( - String sql, - PreparedStatement preparedStatement, - SharedSessionContractImplementor session) { - final GeneratedValues generatedValues = executeAndExtractReturning( sql, preparedStatement, session ); - return generatedValues.getGeneratedValue( persister.getIdentifierMapping() ); - } - protected abstract GeneratedValues executeAndExtractReturning( String sql, PreparedStatement preparedStatement, diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractSelectingDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractSelectingDelegate.java index 4c2ad98a25..e0aeb94448 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractSelectingDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/AbstractSelectingDelegate.java @@ -19,7 +19,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.generator.EventType; import org.hibernate.generator.values.AbstractGeneratedValuesMutationDelegate; import org.hibernate.generator.values.GeneratedValues; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.pretty.MessageHelper; @@ -35,13 +34,6 @@ import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getG */ public abstract class AbstractSelectingDelegate extends AbstractGeneratedValuesMutationDelegate implements InsertGeneratedIdentifierDelegate { - /** - * @deprecated Use {@link #AbstractSelectingDelegate(EntityPersister, EventType, boolean, boolean)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - protected AbstractSelectingDelegate(PostInsertIdentityPersister persister) { - super( persister, EventType.INSERT ); - } protected AbstractSelectingDelegate( EntityPersister persister, @@ -62,16 +54,6 @@ public abstract class AbstractSelectingDelegate extends AbstractGeneratedValuesM throws SQLException { } - /** - * @deprecated No substitute. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - protected Object extractGeneratedValues(ResultSet resultSet, SharedSessionContractImplementor session) - throws SQLException { - final GeneratedValues generatedValues = extractReturningValues( resultSet, session ); - return generatedValues.getGeneratedValue( persister.getIdentifierMapping() ); - } - /** * Extract the generated key value from the given result set after execution of {@link #getSelectSQL()}. */ diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/BasicSelectingDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/BasicSelectingDelegate.java index 4cbce62edc..30045e1913 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/BasicSelectingDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/BasicSelectingDelegate.java @@ -6,10 +6,8 @@ */ package org.hibernate.id.insert; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.generator.EventType; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.internal.CoreLogging; import org.hibernate.jdbc.Expectation; import org.hibernate.persister.entity.EntityPersister; @@ -23,14 +21,6 @@ import org.hibernate.sql.model.ast.builder.TableMutationBuilder; public class BasicSelectingDelegate extends AbstractSelectingDelegate { final private EntityPersister persister; - /** - * @deprecated Use {@link #BasicSelectingDelegate(EntityPersister)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public BasicSelectingDelegate(PostInsertIdentityPersister persister, Dialect dialect) { - this( persister ); - } - public BasicSelectingDelegate(EntityPersister persister) { super( persister, EventType.INSERT, false, false ); this.persister = persister; diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/GetGeneratedKeysDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/GetGeneratedKeysDelegate.java index 63d8c20894..89aa73c8a6 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/GetGeneratedKeysDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/GetGeneratedKeysDelegate.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.mutation.JdbcValueBindings; import org.hibernate.engine.jdbc.mutation.group.PreparedStatementDetails; import org.hibernate.engine.jdbc.spi.JdbcCoordinator; @@ -24,7 +23,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.generator.EventType; import org.hibernate.generator.values.GeneratedValueBasicResultBuilder; import org.hibernate.generator.values.GeneratedValues; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.jdbc.Expectation; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.sql.model.ast.builder.TableInsertBuilderStandard; @@ -47,14 +45,6 @@ import static org.hibernate.internal.util.StringHelper.unquote; public class GetGeneratedKeysDelegate extends AbstractReturningDelegate { private final String[] columnNames; - /** - * @deprecated Use {@link #GetGeneratedKeysDelegate(EntityPersister, boolean, EventType)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public GetGeneratedKeysDelegate(PostInsertIdentityPersister persister, Dialect dialect, boolean inferredKeys) { - this( persister, inferredKeys, EventType.INSERT ); - } - public GetGeneratedKeysDelegate( EntityPersister persister, boolean inferredKeys, diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/IdentifierGeneratingInsert.java b/hibernate-core/src/main/java/org/hibernate/id/insert/IdentifierGeneratingInsert.java deleted file mode 100644 index 435244d555..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/IdentifierGeneratingInsert.java +++ /dev/null @@ -1,23 +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 . - */ -package org.hibernate.id.insert; -import org.hibernate.dialect.Dialect; -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.sql.Insert; - -/** - * Nothing more than a distinguishing subclass of {@link Insert} used to - * indicate intent. Some subclasses of this also provided some additional - * functionality or semantic to the generated SQL statement string. - * - * @author Steve Ebersole - */ -public class IdentifierGeneratingInsert extends Insert { - public IdentifierGeneratingInsert(SessionFactoryImplementor sessionFactory) { - super( sessionFactory ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/InsertGeneratedIdentifierDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/InsertGeneratedIdentifierDelegate.java index f81fd0d222..4904427db7 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/InsertGeneratedIdentifierDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/InsertGeneratedIdentifierDelegate.java @@ -8,16 +8,9 @@ package org.hibernate.id.insert; import java.sql.PreparedStatement; -import org.hibernate.engine.jdbc.mutation.JdbcValueBindings; -import org.hibernate.engine.jdbc.mutation.group.PreparedStatementDetails; -import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.generator.values.GeneratedValues; import org.hibernate.generator.values.GeneratedValuesMutationDelegate; -import org.hibernate.jdbc.Expectation; -import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping; -import org.hibernate.persister.entity.EntityPersister; -import org.hibernate.sql.model.ast.builder.TableInsertBuilder; /** * Each implementation defines a strategy for retrieving a primary key @@ -42,43 +35,12 @@ import org.hibernate.sql.model.ast.builder.TableInsertBuilder; * * @deprecated Use {@link GeneratedValuesMutationDelegate} instead. */ -@Deprecated( forRemoval = true, since = "6.5" ) +@Deprecated(since = "6.5", forRemoval = true) public interface InsertGeneratedIdentifierDelegate extends GeneratedValuesMutationDelegate { - /** - * Create a {@link TableInsertBuilder} with any specific identity - * handling already built in. - */ - default TableInsertBuilder createTableInsertBuilder( - BasicEntityIdentifierMapping identifierMapping, - Expectation expectation, - SessionFactoryImplementor sessionFactory) { - return (TableInsertBuilder) createTableMutationBuilder( expectation, sessionFactory ); - } @Override PreparedStatement prepareStatement(String insertSql, SharedSessionContractImplementor session); - /** - * Perform the {@code insert} and extract the database-generated - * primary key value. - * - * @see #createTableInsertBuilder - */ - default Object performInsert( - PreparedStatementDetails insertStatementDetails, - JdbcValueBindings valueBindings, - Object entity, - SharedSessionContractImplementor session) { - final EntityPersister entityPersister = session.getEntityPersister( null, entity ); - final GeneratedValues generatedValues = performMutation( - insertStatementDetails, - valueBindings, - entity, - session - ); - return generatedValues.getGeneratedValue( entityPersister.getIdentifierMapping() ); - } - /** * Append SQL specific to this delegate's mode of handling generated * primary key values to the given {@code insert} statement. @@ -89,22 +51,6 @@ public interface InsertGeneratedIdentifierDelegate extends GeneratedValuesMutati return insertSQL; } - /** - * Execute the given {@code insert} statement and return the generated - * key value. - * - * @param insertSQL The {@code insert} statement string - * @param session The session in which we are operating - * @param binder The parameter binder - * - * @return The generated identifier value - */ - default Object performInsert(String insertSQL, SharedSessionContractImplementor session, Binder binder) { - final EntityPersister entityPersister = session.getEntityPersister( null, binder.getEntity() ); - final GeneratedValues generatedValues = performInsertReturning( insertSQL, session, binder ); - return generatedValues.getGeneratedValue( entityPersister.getIdentifierMapping() ); - } - /** * Execute the given {@code insert} statement and return the generated * key value. diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/InsertReturningDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/InsertReturningDelegate.java index edb48edd07..2e78d1ac23 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/InsertReturningDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/InsertReturningDelegate.java @@ -12,7 +12,6 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.spi.JdbcCoordinator; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.spi.SessionFactoryImplementor; @@ -22,7 +21,6 @@ import org.hibernate.generator.values.GeneratedValueBasicResultBuilder; import org.hibernate.generator.values.GeneratedValues; import org.hibernate.generator.values.GeneratedValuesMutationDelegate; import org.hibernate.generator.values.internal.TableUpdateReturningBuilder; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.jdbc.Expectation; import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping; import org.hibernate.persister.entity.EntityPersister; @@ -47,14 +45,6 @@ public class InsertReturningDelegate extends AbstractReturningDelegate { private final MutatingTableReference tableReference; private final List generatedColumns; - /** - * @deprecated Use {@link #InsertReturningDelegate(EntityPersister, EventType)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public InsertReturningDelegate(PostInsertIdentityPersister persister, Dialect dialect) { - this( persister, EventType.INSERT ); - } - public InsertReturningDelegate(EntityPersister persister, EventType timing) { super( persister, diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/InsertSelectIdentityInsert.java b/hibernate-core/src/main/java/org/hibernate/id/insert/InsertSelectIdentityInsert.java deleted file mode 100644 index 41a843051e..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/InsertSelectIdentityInsert.java +++ /dev/null @@ -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 . - */ -package org.hibernate.id.insert; -import org.hibernate.MappingException; -import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.sql.Insert; -import org.hibernate.generator.OnExecutionGenerator; - -/** - * Specialized {@link IdentifierGeneratingInsert} which appends the database - * specific clause which signifies to return generated {@code IDENTITY} values - * to the end of the insert statement. - * - * @author Steve Ebersole - * - * @deprecated This is not used anymore in any of the - * {@link org.hibernate.generator.values.GeneratedValuesMutationDelegate} implementations. - */ -@Deprecated( since = "6.5" ) -public class InsertSelectIdentityInsert extends IdentifierGeneratingInsert { - protected String identityColumnName; - - public InsertSelectIdentityInsert(SessionFactoryImplementor sessionFactory) { - super( sessionFactory ); - } - - public Insert addIdentityColumn(String columnName) { - identityColumnName = columnName; - return super.addIdentityColumn( columnName ); - } - - @Override - public Insert addGeneratedColumns(String[] columnNames, OnExecutionGenerator generator) { - if ( columnNames.length != 1 ) { - //TODO: Should this allow multiple columns? Would require changing - // IdentityColumnSupport.appendIdentitySelectToInsert() - throw new MappingException("wrong number of generated columns"); - } - identityColumnName = columnNames[0]; - return super.addGeneratedColumns( columnNames, generator ); - } - - public String toStatementString() { - return getDialect().getIdentityColumnSupport() - .appendIdentitySelectToInsert( identityColumnName, super.toStatementString() ); - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/SybaseJConnGetGeneratedKeysDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/SybaseJConnGetGeneratedKeysDelegate.java index ed245d13a8..8386948a5c 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/SybaseJConnGetGeneratedKeysDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/SybaseJConnGetGeneratedKeysDelegate.java @@ -10,33 +10,24 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.spi.JdbcCoordinator; import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.generator.EventType; import org.hibernate.generator.values.GeneratedValues; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.metamodel.mapping.BasicEntityIdentifierMapping; import org.hibernate.persister.entity.EntityPersister; import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getGeneratedValues; /** - * Specialized {@link IdentifierGeneratingInsert} which appends the database + * Specialized {@link GetGeneratedKeysDelegate} which appends the database * specific clause which signifies to return generated {@code IDENTITY} values * to the end of the insert statement. * * @author Christian Beikov */ public class SybaseJConnGetGeneratedKeysDelegate extends GetGeneratedKeysDelegate { - /** - * @deprecated Use {@link #SybaseJConnGetGeneratedKeysDelegate(EntityPersister)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public SybaseJConnGetGeneratedKeysDelegate(PostInsertIdentityPersister persister, Dialect dialect) { - this( persister ); - } public SybaseJConnGetGeneratedKeysDelegate(EntityPersister persister) { super( persister, true, EventType.INSERT ); diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/TableInsertReturningBuilder.java b/hibernate-core/src/main/java/org/hibernate/id/insert/TableInsertReturningBuilder.java index ca6b3385bc..862af2a9b2 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/TableInsertReturningBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/TableInsertReturningBuilder.java @@ -6,13 +6,9 @@ */ package org.hibernate.id.insert; -import java.util.ArrayList; import java.util.List; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.id.PostInsertIdentityPersister; -import org.hibernate.metamodel.mapping.EntityRowIdMapping; -import org.hibernate.metamodel.mapping.ModelPart; import org.hibernate.persister.entity.EntityPersister; import org.hibernate.sql.ast.tree.expression.ColumnReference; import org.hibernate.sql.model.ast.MutatingTableReference; @@ -20,42 +16,12 @@ import org.hibernate.sql.model.ast.TableInsert; import org.hibernate.sql.model.ast.builder.AbstractTableInsertBuilder; import org.hibernate.sql.model.internal.TableInsertStandard; -import static org.hibernate.generator.values.internal.GeneratedValuesHelper.getActualGeneratedModelPart; -import static org.hibernate.internal.util.NullnessUtil.castNonNull; - /** * @author Steve Ebersole */ public class TableInsertReturningBuilder extends AbstractTableInsertBuilder { private final List generatedColumns; - /** - * @deprecated Use {@link #TableInsertReturningBuilder(EntityPersister, MutatingTableReference, List, SessionFactoryImplementor)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public TableInsertReturningBuilder( - PostInsertIdentityPersister mutationTarget, - SessionFactoryImplementor sessionFactory) { - this( - mutationTarget, - new MutatingTableReference( mutationTarget.getIdentifierTableMapping() ), - new ArrayList<>(), - sessionFactory - ); - final List insertGeneratedProperties = getMutationTarget().getInsertGeneratedProperties(); - for ( final ModelPart prop : insertGeneratedProperties ) { - generatedColumns.add( new ColumnReference( - getMutatingTable(), - getActualGeneratedModelPart( castNonNull( prop.asBasicValuedModelPart() ) ) - ) ); - } - // special case for rowid when the dialect supports it - final EntityRowIdMapping rowIdMapping = getMutationTarget().getRowIdMapping(); - if ( rowIdMapping != null && getJdbcServices().getDialect().supportsInsertReturningRowId() ) { - generatedColumns.add( new ColumnReference( getMutatingTable(), rowIdMapping ) ); - } - } - public TableInsertReturningBuilder( EntityPersister mutationTarget, MutatingTableReference tableReference, diff --git a/hibernate-core/src/main/java/org/hibernate/id/insert/UniqueKeySelectingDelegate.java b/hibernate-core/src/main/java/org/hibernate/id/insert/UniqueKeySelectingDelegate.java index 373118dd84..0277ff7966 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/insert/UniqueKeySelectingDelegate.java +++ b/hibernate-core/src/main/java/org/hibernate/id/insert/UniqueKeySelectingDelegate.java @@ -11,12 +11,10 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import org.hibernate.dialect.Dialect; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.generator.EventType; import org.hibernate.generator.values.GeneratedValueBasicResultBuilder; -import org.hibernate.id.PostInsertIdentityPersister; import org.hibernate.jdbc.Expectation; import org.hibernate.metamodel.mapping.EntityRowIdMapping; import org.hibernate.persister.entity.EntityPersister; @@ -37,14 +35,6 @@ public class UniqueKeySelectingDelegate extends AbstractSelectingDelegate { private final String selectString; - /** - * @deprecated Use {@link #UniqueKeySelectingDelegate(EntityPersister, String[], EventType)} instead. - */ - @Deprecated( forRemoval = true, since = "6.5" ) - public UniqueKeySelectingDelegate(PostInsertIdentityPersister persister, Dialect dialect, String[] uniqueKeyPropertyNames) { - this( persister, uniqueKeyPropertyNames, EventType.INSERT ); - } - public UniqueKeySelectingDelegate( EntityPersister persister, String[] uniqueKeyPropertyNames, diff --git a/hibernate-core/src/main/java/org/hibernate/internal/FetchProfileHelper.java b/hibernate-core/src/main/java/org/hibernate/internal/FetchProfileHelper.java index 79935d7e8c..50dabfaaf3 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/FetchProfileHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/FetchProfileHelper.java @@ -7,6 +7,7 @@ package org.hibernate.internal; import org.hibernate.HibernateException; +import org.hibernate.annotations.FetchMode; import org.hibernate.boot.spi.MetadataImplementor; import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchTiming; @@ -57,7 +58,7 @@ public class FetchProfileHelper { ( (FetchProfileAffectee) owner ).registerAffectingFetchProfile( profileName); final Association association = new Association( owner, mappingFetch.getAssociation() ); - final FetchStyle fetchStyle = Fetch.Style.forMethod( mappingFetch.getMethod() ).toFetchStyle(); + final FetchStyle fetchStyle = fetchStyle( mappingFetch.getMethod() ); final FetchTiming fetchTiming = FetchTiming.forType( mappingFetch.getType() ); // validate the specified association fetch @@ -73,6 +74,19 @@ public class FetchProfileHelper { return fetchProfile; } + private static FetchStyle fetchStyle(FetchMode fetchMode) { + switch ( fetchMode ) { + case JOIN: + return FetchStyle.JOIN; + case SELECT: + return FetchStyle.SELECT; + case SUBSELECT: + return FetchStyle.SUBSELECT; + default: + throw new IllegalArgumentException( "Unknown FetchMode" ); + } + } + private static void validateFetchablePart(ModelPart fetchablePart, String profileName, Association association) { if ( fetchablePart == null ) { throw new HibernateException( String.format( diff --git a/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java index 73bbaaa8da..4bf445cb17 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java @@ -59,11 +59,6 @@ public class JdbcSessionContextImpl implements JdbcSessionContext { return settings().isGetGeneratedKeysEnabled(); } - @Override @Deprecated - public int getFetchSize() { - return settings().getJdbcFetchSize(); - } - @Override public Integer getFetchSizeOrNull() { return settings().getJdbcFetchSize(); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index 12520478e0..846635d6c7 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -217,14 +217,6 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im private final transient SchemaManager schemaManager; - /** - * @deprecated This constructor will be removed - */ - @Deprecated(since = "6.2", forRemoval = true) - public SessionFactoryImpl(MetadataImplementor bootMetamodel, SessionFactoryOptions options) { - this( bootMetamodel, options, bootMetamodel.getTypeConfiguration().getMetadataBuildingContext().getBootstrapContext() ); - } - public SessionFactoryImpl( final MetadataImplementor bootMetamodel, final SessionFactoryOptions options, @@ -776,12 +768,6 @@ public class SessionFactoryImpl extends QueryParameterBindingTypeResolverImpl im return sqlStringGenerationContext; } - @Override @Deprecated - public DeserializationResolver getDeserializationResolver() { - return () -> (SessionFactoryImplementor) - SessionFactoryRegistry.INSTANCE.findSessionFactory( uuid, name ); - } - @Override @SuppressWarnings({"rawtypes","unchecked"}) public List> findEntityGraphsByType(Class entityClass) { return (List) getJpaMetamodel().findEntityGraphsByJavaType( entityClass ); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java index 07c0185c0b..a193cb8d09 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java @@ -2493,9 +2493,6 @@ public class SessionImpl final EffectiveEntityGraph effectiveEntityGraph = loadQueryInfluencers.getEffectiveEntityGraph(); effectiveEntityGraph.applyConfiguredGraph( properties ); loadQueryInfluencers.setReadOnly( getReadOnlyHint( properties ) ); - if ( effectiveEntityGraph.getSemantic() == GraphSemantic.FETCH ) { - setEnforcingFetchGraph( true ); - } return byId( entityClass ) .with( determineAppropriateLocalCacheMode( properties ) ) @@ -2558,7 +2555,6 @@ public class SessionImpl finally { loadQueryInfluencers.getEffectiveEntityGraph().clear(); loadQueryInfluencers.setReadOnly( null ); - setEnforcingFetchGraph( false ); } } @@ -3098,15 +3094,4 @@ public class SessionImpl private Boolean getReadOnlyFromLoadQueryInfluencers() { return loadQueryInfluencers != null ? loadQueryInfluencers.getReadOnly() : null; } - - @Override @Deprecated(forRemoval = true) - public boolean isEnforcingFetchGraph() { - return isEnforcingFetchGraph; - } - - @Override @Deprecated(forRemoval = true) - public void setEnforcingFetchGraph(boolean isEnforcingFetchGraph) { - this.isEnforcingFetchGraph = isEnforcingFetchGraph; - } - } diff --git a/hibernate-core/src/main/java/org/hibernate/jdbc/Expectations.java b/hibernate-core/src/main/java/org/hibernate/jdbc/Expectations.java index 7d871b2d43..a90daed36d 100644 --- a/hibernate-core/src/main/java/org/hibernate/jdbc/Expectations.java +++ b/hibernate-core/src/main/java/org/hibernate/jdbc/Expectations.java @@ -10,12 +10,10 @@ import java.sql.CallableStatement; import java.sql.PreparedStatement; import java.util.function.Supplier; -import org.hibernate.AssertionFailure; import org.hibernate.HibernateException; import org.hibernate.Internal; import org.hibernate.StaleStateException; import org.hibernate.engine.jdbc.spi.SqlExceptionHelper; -import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle; import org.hibernate.internal.CoreLogging; import org.hibernate.internal.CoreMessageLogger; @@ -109,52 +107,6 @@ public class Expectations { } } - // Base Expectation impls ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - /** - * @deprecated Use {@link RowCount}, creating a custom subclass if necessary - */ - @Deprecated(since = "6.5") - public static class BasicExpectation extends Expectation.RowCount { - private final int expectedRowCount; - - protected BasicExpectation(int expectedRowCount) { - this.expectedRowCount = expectedRowCount; - if ( expectedRowCount < 0 ) { - throw new IllegalArgumentException( "Expected row count must be greater than zero" ); - } - } - - @Override - protected int expectedRowCount() { - return expectedRowCount; - } - } - - /** - * @deprecated Use {@link OutParameter}, creating a custom subclass if necessary - */ - @Deprecated(since = "6.5") - public static class BasicParamExpectation extends Expectation.OutParameter { - private final int parameterPosition; - private final int expectedRowCount; - - protected BasicParamExpectation(int expectedRowCount, int parameterPosition) { - this.expectedRowCount = expectedRowCount; - this.parameterPosition = parameterPosition; - } - - @Override - protected int expectedRowCount() { - return expectedRowCount; - } - - @Override - protected int parameterIndex() { - return parameterPosition; - } - } - // Various Expectation instances ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /** @@ -175,29 +127,6 @@ public class Expectations { @Deprecated(since = "6.5") public static final Expectation PARAM = new Expectation.OutParameter(); - @Deprecated(since = "6.5", forRemoval = true) - public static Expectation appropriateExpectation(ExecuteUpdateResultCheckStyle style) { - switch ( style ) { - case NONE: - return NONE; - case COUNT: - return BASIC; - case PARAM: - return PARAM; - default: - throw new AssertionFailure( "unknown result check style: " + style ); - } - } - private Expectations() { } - - // Unused, for removal ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - @Deprecated(since = "6.5", forRemoval = true) - public static final int USUAL_EXPECTED_COUNT = 1; - - @Deprecated(since = "6.5", forRemoval = true) - public static final int USUAL_PARAM_POSITION = 1; - } diff --git a/hibernate-core/src/main/java/org/hibernate/loader/PropertyPath.java b/hibernate-core/src/main/java/org/hibernate/loader/PropertyPath.java deleted file mode 100644 index 644c982600..0000000000 --- a/hibernate-core/src/main/java/org/hibernate/loader/PropertyPath.java +++ /dev/null @@ -1,94 +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 . - */ -package org.hibernate.loader; - -import org.hibernate.internal.util.StringHelper; -import org.hibernate.spi.DotIdentifierSequence; -import org.hibernate.spi.NavigablePath; - -/** - * @author Steve Ebersole - * - * @deprecated Use {@link NavigablePath} or {@link org.hibernate.metamodel.model.domain.NavigableRole} - * instead, depending on need. - */ -@Deprecated(since = "6", forRemoval = true) -public class PropertyPath implements DotIdentifierSequence { - public static final String IDENTIFIER_MAPPER_PROPERTY = NavigablePath.IDENTIFIER_MAPPER_PROPERTY; - - - private final PropertyPath parent; - private final String property; - private final String fullPath; - - public PropertyPath(PropertyPath parent, String property) { - this.parent = parent; - this.property = property; - - // the _identifierMapper is a "hidden" property on entities with composite keys. - // concatenating it will prevent the path from correctly being used to look up - // various things such as criteria paths and fetch profile association paths - if ( IDENTIFIER_MAPPER_PROPERTY.equals( property ) ) { - this.fullPath = parent != null ? parent.getFullPath() : ""; - } - else { - final String prefix; - if ( parent != null ) { - final String resolvedParent = parent.getFullPath(); - if ( StringHelper.isEmpty( resolvedParent ) ) { - prefix = ""; - } - else { - prefix = resolvedParent + '.'; - } - } - else { - prefix = ""; - } - - this.fullPath = prefix + property; - } - } - - public PropertyPath(String property) { - this( null, property ); - } - - public PropertyPath() { - this( "" ); - } - - public PropertyPath append(String property) { - return new PropertyPath( this, property ); - } - - public PropertyPath getParent() { - return parent; - } - - @Override - public String getLocalName() { - return property; - } - - public String getProperty() { - return property; - } - - public String getFullPath() { - return fullPath; - } - - public boolean isRoot() { - return parent == null && StringHelper.isEmpty( property ); - } - - @Override - public String toString() { - return getClass().getSimpleName() + '[' + fullPath + ']'; - } -} diff --git a/hibernate-core/src/main/java/org/hibernate/loader/ast/spi/AfterLoadAction.java b/hibernate-core/src/main/java/org/hibernate/loader/ast/spi/AfterLoadAction.java index be6c4b5cac..c02c05d55a 100644 --- a/hibernate-core/src/main/java/org/hibernate/loader/ast/spi/AfterLoadAction.java +++ b/hibernate-core/src/main/java/org/hibernate/loader/ast/spi/AfterLoadAction.java @@ -19,13 +19,4 @@ public interface AfterLoadAction { * The action trigger - the {@code entity} is being loaded */ void afterLoad(Object entity, EntityMappingType entityMappingType, SharedSessionContractImplementor session); - - /** - * @deprecated Use the {@linkplain #afterLoad(Object, EntityMappingType, SharedSessionContractImplementor) updated form} - */ - @SuppressWarnings("removal") - @Deprecated(since = "6", forRemoval = true) - default void afterLoad(SharedSessionContractImplementor session, Object entity, org.hibernate.persister.entity.Loadable persister) { - afterLoad( entity, persister, session ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java b/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java index 31c1f90540..78891828a8 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java @@ -592,14 +592,6 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe return customInsertCallable; } - /** - * @deprecated use {@link #getInsertExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle() { - return insertCheckStyle; - } - public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) { this.customSQLUpdate = customSQLUpdate; this.customUpdateCallable = callable; @@ -615,14 +607,6 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe return customUpdateCallable; } - /** - * @deprecated use {@link #getUpdateExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle() { - return updateCheckStyle; - } - public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) { this.customSQLDelete = customSQLDelete; this.customDeleteCallable = callable; @@ -638,14 +622,6 @@ public abstract class Collection implements Fetchable, Value, Filterable, SoftDe return customDeleteCallable; } - /** - * @deprecated use {@link #getDeleteExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle() { - return deleteCheckStyle; - } - public void setCustomSQLDeleteAll( String customSQLDeleteAll, boolean callable, diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java index 00026200f2..5b3070deed 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java @@ -19,7 +19,6 @@ import java.util.Set; import org.hibernate.Internal; import org.hibernate.MappingException; -import org.hibernate.Remove; import org.hibernate.boot.model.relational.Database; import org.hibernate.boot.model.relational.ExportableProducer; import org.hibernate.boot.model.relational.QualifiedName; @@ -166,11 +165,6 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable return properties.size(); } - @Deprecated @Remove - public Iterator getPropertyIterator() { - return properties.iterator(); - } - public List getProperties() { return properties; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java b/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java index 1a94131556..c274d5c5b3 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java @@ -5,20 +5,13 @@ * See the lgpl.txt file in the root directory or . */ package org.hibernate.mapping; + import java.io.Serializable; -import java.math.BigInteger; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; import java.util.List; -import org.hibernate.HibernateException; import org.hibernate.MappingException; import org.hibernate.boot.model.relational.Exportable; -import org.hibernate.boot.model.relational.SqlStringGenerationContext; -import org.hibernate.dialect.Dialect; /** * A mapping model object representing a constraint on a relational database table. @@ -40,82 +33,6 @@ public abstract class Constraint implements Exportable, Serializable { this.name = name; } - /** - * If a constraint is not explicitly named, this is called to generate - * a unique hash using the table and column names. - * Static so the name can be generated prior to creating the Constraint. - * They're cached, keyed by name, in multiple locations. - * - * @return String The generated name - * - * @deprecated This method does not respect the {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy} - */ - @Deprecated(since = "6.5", forRemoval = true) - public static String generateName(String prefix, Table table, Column... columns) { - // Use a concatenation that guarantees uniqueness, even if identical names - // exist between all table and column identifiers. - final StringBuilder sb = new StringBuilder( "table`" + table.getName() + "`" ); - // Ensure a consistent ordering of columns, regardless of the order - // they were bound. - // Clone the list, as sometimes a set of order-dependent Column - // bindings are given. - final Column[] alphabeticalColumns = columns.clone(); - Arrays.sort( alphabeticalColumns, Comparator.comparing( Column::getName ) ); - for ( Column column : alphabeticalColumns ) { - final String columnName = column == null ? "" : column.getName(); - sb.append( "column`" ).append( columnName ).append( "`" ); - } - return prefix + hashedName( sb.toString() ); - } - - /** - * Helper method for {@link #generateName(String, Table, Column...)}. - * - * @return String The generated name - * - * @deprecated This method does not respect the {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy} - */ - @Deprecated(since = "6.5", forRemoval = true) - public static String generateName(String prefix, Table table, List columns) { - // N.B. legacy APIs are involved: can't trust that the columns List is actually - // containing Column instances - the generic type isn't consistently enforced. - // So some elements might be Formula instances, but they don't need to be part - // of the name generation. - final Column[] defensive = columns.stream() - .filter( (Object thing) -> thing instanceof Column ) - .toArray( Column[]::new ); - return generateName( prefix, table, defensive); - } - - /** - * Hash a constraint name using MD5. Convert the MD5 digest to base 35 - * (full alphanumeric), guaranteeing - * that the length of the name will always be smaller than the 30 - * character identifier restriction enforced by a few dialects. - * - * @param name The name to be hashed. - * @return String The hashed name. - * - * @deprecated Only used from deprecated methods - */ - @Deprecated(since = "6.5", forRemoval = true) - public static String hashedName(String name) { - try { - final MessageDigest md = MessageDigest.getInstance( "MD5" ); - md.reset(); - md.update( name.getBytes() ); - final byte[] digest = md.digest(); - final BigInteger bigInt = new BigInteger( 1, digest ); - // By converting to base 35 (full alphanumeric), we guarantee - // that the length of the name will always be smaller than the 30 - // character identifier restriction enforced by a few dialects. - return bigInt.toString( 35 ); - } - catch ( NoSuchAlgorithmException e ) { - throw new HibernateException( "Unable to generate a hashed Constraint name", e ); - } - } - public void addColumn(Column column) { if ( !columns.contains( column ) ) { columns.add( column ); @@ -156,37 +73,11 @@ public abstract class Constraint implements Exportable, Serializable { this.table = table; } - /** - * @deprecated No longer used - */ - @Deprecated(forRemoval = true) - public boolean isGenerated(Dialect dialect) { - return true; - } - public List getColumns() { return columns; } - /** - * @deprecated this method is no longer called - */ - @Deprecated(since="6.2", forRemoval = true) - public abstract String sqlConstraintString( - SqlStringGenerationContext context, - String constraintName, - String defaultCatalog, - String defaultSchema); - public String toString() { return getClass().getSimpleName() + '(' + getTable().getName() + getColumns() + ") as " + name; } - - /** - * @return String The prefix to use in generated constraint names. Examples: - * "UK_", "FK_", and "PK_". - * @deprecated No longer used, should be removed - */ - @Deprecated(since="6.5", forRemoval = true) - public abstract String generatedConstraintNamePrefix(); } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java b/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java index 0eb210f38a..c7b5af39d9 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java @@ -112,16 +112,6 @@ public class DenormalizedTable extends Table { return includedTable.getPrimaryKey(); } - @Override @Deprecated(forRemoval = true) - public Iterator getUniqueKeyIterator() { - if ( !includedTable.isPhysicalTable() ) { - for ( UniqueKey uniqueKey : includedTable.getUniqueKeys().values() ) { - createUniqueKey( uniqueKey.getColumns() ); - } - } - return getUniqueKeys().values().iterator(); - } - public Table getIncludedTable() { return includedTable; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/FetchProfile.java b/hibernate-core/src/main/java/org/hibernate/mapping/FetchProfile.java index 05718996fd..951e7c3b9e 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/FetchProfile.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/FetchProfile.java @@ -10,9 +10,6 @@ import jakarta.persistence.FetchType; import org.hibernate.annotations.FetchMode; import java.util.LinkedHashSet; -import java.util.Locale; - -import static jakarta.persistence.FetchType.EAGER; /** * A mapping model object representing a {@link org.hibernate.annotations.FetchProfile}. @@ -65,20 +62,6 @@ public class FetchProfile { return fetches; } - /** - * Adds a fetch to this profile. - * - * @param entity The entity which contains the association to be fetched - * @param association The association to fetch - * @param style The style of fetch to apply - * - * @deprecated use {@link #addFetch(Fetch)} - */ - @Deprecated(forRemoval = true) - public void addFetch(String entity, String association, String style) { - addFetch( new Fetch( entity, association, style ) ); - } - /** * Adds a fetch to this profile. */ @@ -122,26 +105,6 @@ public class FetchProfile { this.type = type; } - /** - * @deprecated use {@link FetchProfile.Fetch#Fetch(String,String,FetchMode,FetchType)} - */ - @Deprecated(forRemoval = true) - public Fetch(String entity, String association, String style) { - this.entity = entity; - this.association = association; - this.method = fetchMode( style ); - this.type = EAGER; - } - - private FetchMode fetchMode(String style) { - for ( FetchMode mode: FetchMode.values() ) { - if ( mode.name().equalsIgnoreCase( style ) ) { - return mode; - } - } - throw new IllegalArgumentException( "Unknown FetchMode: " + style ); - } - public String getEntity() { return entity; } @@ -150,14 +113,6 @@ public class FetchProfile { return association; } - /** - * @deprecated use {@link #getMethod()} - */ - @Deprecated(forRemoval = true) - public String getStyle() { - return method.toString().toLowerCase(Locale.ROOT); - } - public FetchMode getMethod() { return method; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/ForeignKey.java b/hibernate-core/src/main/java/org/hibernate/mapping/ForeignKey.java index 34ce44eeb6..ae7fe83a88 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/ForeignKey.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/ForeignKey.java @@ -14,8 +14,6 @@ import org.hibernate.Internal; import org.hibernate.MappingException; import org.hibernate.annotations.OnDeleteAction; import org.hibernate.boot.Metadata; -import org.hibernate.boot.model.relational.SqlStringGenerationContext; -import org.hibernate.dialect.Dialect; import static org.hibernate.internal.util.StringHelper.qualify; @@ -25,6 +23,7 @@ import static org.hibernate.internal.util.StringHelper.qualify; * @author Gavin King */ public class ForeignKey extends Constraint { + private Table referencedTable; private String referencedEntityName; private String keyDefinition; @@ -32,6 +31,10 @@ public class ForeignKey extends Constraint { private final List referencedColumns = new ArrayList<>(); private boolean creationEnabled = true; + public ForeignKey(Table table){ + setTable( table ); + } + public ForeignKey() { } @@ -59,41 +62,6 @@ public class ForeignKey extends Constraint { } } - @Override @Deprecated(since="6.2", forRemoval = true) - public String sqlConstraintString( - SqlStringGenerationContext context, - String constraintName, - String defaultCatalog, - String defaultSchema) { - Dialect dialect = context.getDialect(); - String[] columnNames = new String[getColumnSpan()]; - String[] referencedColumnNames = new String[getColumnSpan()]; - - final List referencedColumns = isReferenceToPrimaryKey() - ? referencedTable.getPrimaryKey().getColumns() - : this.referencedColumns; - - List columns = getColumns(); - for ( int i=0; i selectables = new ArrayList<>(); private final java.util.Map selectableOrderMap = new HashMap<>(); - /** - * @deprecated This method will be removed in the next release - */ - @Deprecated(forRemoval = true) - public static String buildSqlDropIndexString(String name, String tableName) { - return "drop index " + qualify( tableName, name ); - } - - /** - * @deprecated This method will be removed in the next release - */ - @Deprecated(forRemoval = true) - public static String buildSqlCreateIndexString( - Dialect dialect, - String name, - String tableName, - java.util.List columns, - java.util.Map columnOrderMap, - boolean unique) { - StringBuilder statement = new StringBuilder( dialect.getCreateIndexString( unique ) ) - .append( " " ) - .append( dialect.qualifyIndexName() ? name : unqualify( name ) ) - .append( " on " ) - .append( tableName ) - .append( " (" ); - boolean first = true; - for ( Column column : columns ) { - if ( first ) { - first = false; - } - else { - statement.append(", "); - } - statement.append( column.getQuotedName( dialect ) ); - if ( columnOrderMap.containsKey( column ) ) { - statement.append( " " ).append( columnOrderMap.get( column ) ); - } - } - statement.append( ")" ); - statement.append( dialect.getCreateIndexTail( unique, columns ) ); - - return statement.toString(); - } - - /** - * @deprecated This method will be removed in the next release - */ - @Deprecated(forRemoval = true) - public static String buildSqlCreateIndexString( - SqlStringGenerationContext context, - String name, - Table table, - java.util.List columns, - java.util.Map columnOrderMap, - boolean unique, - Metadata metadata) { - return buildSqlCreateIndexString( - context.getDialect(), - name, - context.format( table.getQualifiedTableName() ), - columns, - columnOrderMap, - unique - ); - } - public Table getTable() { return table; } @@ -166,24 +97,6 @@ public class Index implements Exportable, Serializable { } } - /** - * @deprecated use {@link #getSelectableOrderMap()} - */ - @Deprecated(since = "6.3", forRemoval = true) - public void addColumns(java.util.List extraColumns) { - for ( Column column : extraColumns ) { - addColumn( column ); - } - } - - /** - * @deprecated use {@link #getSelectableOrderMap()} - */ - @Deprecated(since = "6.3", forRemoval = true) - public boolean containsColumn(Column column) { - return selectables.contains( column ); - } - public String getName() { return name == null ? null : name.getText(); } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Join.java b/hibernate-core/src/main/java/org/hibernate/mapping/Join.java index 7418078f11..494624cbdc 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Join.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Join.java @@ -8,7 +8,6 @@ package org.hibernate.mapping; import java.io.Serializable; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.function.Supplier; @@ -84,11 +83,6 @@ public class Join implements AttributeContainer, Serializable { return properties.contains( property ); } - @Deprecated(since = "6.0") - public Iterator getPropertyIterator() { - return properties.iterator(); - } - public Table getTable() { return table; } @@ -152,14 +146,6 @@ public class Join implements AttributeContainer, Serializable { return customInsertCallable; } - /** - * @deprecated use {@link #getInsertExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle() { - return insertCheckStyle; - } - public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) { this.customSQLUpdate = customSQLUpdate; this.customUpdateCallable = callable; @@ -175,14 +161,6 @@ public class Join implements AttributeContainer, Serializable { return customUpdateCallable; } - /** - * @deprecated use {@link #getUpdateExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle() { - return updateCheckStyle; - } - public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) { this.customSQLDelete = customSQLDelete; this.customDeleteCallable = callable; @@ -198,14 +176,6 @@ public class Join implements AttributeContainer, Serializable { return customDeleteCallable; } - /** - * @deprecated use {@link #getDeleteExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle() { - return deleteCheckStyle; - } - public boolean isInverse() { return inverse; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java b/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java index 56fd2100f2..b1b8dd4ccb 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java @@ -6,7 +6,6 @@ */ package org.hibernate.mapping; -import java.util.Iterator; import java.util.List; import java.util.Objects; @@ -117,15 +116,6 @@ public class OneToOne extends ToOne { return columns; } - /** - * @deprecated Use {@link #getSelectables()} instead - */ - @Deprecated(forRemoval = true, since = "6.3") - @Override - public Iterator getConstraintColumnIterator() { - return identifier.getSelectables().iterator(); - } - /** * Returns the constrained. * @return boolean diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java b/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java index 82484365fa..a374271044 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java @@ -30,7 +30,6 @@ import org.hibernate.internal.FilterConfiguration; import org.hibernate.internal.util.collections.JoinedList; import org.hibernate.jdbc.Expectation; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; -import org.hibernate.persister.entity.EntityPersister; import org.hibernate.jpa.event.spi.CallbackDefinition; import org.hibernate.query.sqm.function.SqmFunctionRegistry; import org.hibernate.service.ServiceRegistry; @@ -329,22 +328,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut isCached = cached; } - /** - * @deprecated Use {@link #isCached} instead - */ - @Deprecated(forRemoval = true) - public boolean isCachingExplicitlyRequested() { - return isCached(); - } - - /** - * @deprecated Use {@link #setCached} instead - */ - @Deprecated(forRemoval = true) - public void setCachingExplicitlyRequested(boolean cached) { - setCached( cached ); - } - public CacheLayout getQueryCacheLayout() { return queryCacheLayout; } @@ -580,25 +563,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut } } - /** - * @deprecated This will be removed with no replacement. - */ - @Deprecated(since = "6.2", forRemoval = true) - public Property getSubclassProperty(String propertyName) throws MappingException { - final Property identifierProperty = getIdentifierProperty(); - if ( identifierProperty != null - && identifierProperty.getName().equals( root( propertyName ) ) ) { - return identifierProperty; - } - else { - final Component identifierMapper = getIdentifierMapper(); - final List closure = identifierMapper != null - ? new JoinedList<>( identifierMapper.getProperties(), getSubclassPropertyClosure() ) - : getSubclassPropertyClosure(); - return getProperty( propertyName, closure ); - } - } - /** * Check to see if this PersistentClass defines a property with the given name. * @@ -650,22 +614,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut || getSuperclass() != null && getSuperclass().isPropertyDefinedInHierarchy( name ); } - /** - * @deprecated prefer {@link #getOptimisticLockStyle} - */ - @Deprecated(forRemoval = true) - public int getOptimisticLockMode() { - return getOptimisticLockStyle().getOldCode(); - } - - /** - * @deprecated prefer {@link #setOptimisticLockStyle} - */ - @Deprecated(forRemoval = true) - public void setOptimisticLockMode(int optimisticLockMode) { - setOptimisticLockStyle( OptimisticLockStyle.interpretOldCode( optimisticLockMode ) ); - } - public OptimisticLockStyle getOptimisticLockStyle() { return optimisticLockStyle; } @@ -812,14 +760,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut return customInsertCallable; } - /** - * @deprecated use {@link #getInsertExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLInsertCheckStyle() { - return insertCheckStyle; - } - public void setCustomSQLUpdate(String customSQLUpdate, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) { this.customSQLUpdate = customSQLUpdate; this.customUpdateCallable = callable; @@ -835,14 +775,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut return customUpdateCallable; } - /** - * @deprecated use {@link #getUpdateExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLUpdateCheckStyle() { - return updateCheckStyle; - } - public void setCustomSQLDelete(String customSQLDelete, boolean callable, ExecuteUpdateResultCheckStyle checkStyle) { this.customSQLDelete = customSQLDelete; this.customDeleteCallable = callable; @@ -858,14 +790,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut return customDeleteCallable; } - /** - * @deprecated use {@link #getDeleteExpectation()} - */ - @Deprecated(since = "6.5", forRemoval = true) - public ExecuteUpdateResultCheckStyle getCustomSQLDeleteCheckStyle() { - return deleteCheckStyle; - } - public void addFilter( String name, String condition, diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java b/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java index 9fd2d00585..e3638902d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/PrimaryKey.java @@ -10,11 +10,8 @@ import java.util.Arrays; import java.util.List; import org.hibernate.Internal; -import org.hibernate.boot.model.relational.SqlStringGenerationContext; -import org.hibernate.dialect.Dialect; -import org.hibernate.internal.util.StringHelper; -import org.jboss.logging.Logger; +import static org.hibernate.internal.util.StringHelper.qualify; /** * A mapping model object representing a primary key constraint. @@ -23,7 +20,6 @@ import org.jboss.logging.Logger; * @author Steve Ebersole */ public class PrimaryKey extends Constraint { - private static final Logger log = Logger.getLogger( PrimaryKey.class ); private UniqueKey orderingUniqueKey = null; private int[] originalOrder; @@ -32,90 +28,30 @@ public class PrimaryKey extends Constraint { setTable( table ); } + public PrimaryKey() { + } + @Override public void addColumn(Column column) { + // force primary key columns to not-null for ( Column next : getTable().getColumns() ) { if ( next.getCanonicalName().equals( column.getCanonicalName() ) ) { next.setNullable( false ); - if ( log.isDebugEnabled() ) { - log.debugf( - "Forcing column [%s] to be non-null as it is part of the primary key for table [%s]", - column.getCanonicalName(), - getTableNameForLogging( column ) - ); - } } } super.addColumn( column ); } - protected String getTableNameForLogging(Column column) { - if ( getTable() != null ) { - if ( getTable().getNameIdentifier() != null ) { - return getTable().getNameIdentifier().getCanonicalName(); - } - else { - return ""; - } - } - else if ( column.getValue() != null && column.getValue().getTable() != null ) { - return column.getValue().getTable().getNameIdentifier().getCanonicalName(); - } - return ""; - } - - public String sqlConstraintString(Dialect dialect) { - StringBuilder buf = new StringBuilder(); - if ( orderingUniqueKey != null && orderingUniqueKey.isNameExplicit() ) { - buf.append( "constraint " ).append( orderingUniqueKey.getName() ).append( ' ' ); - } - buf.append( "primary key (" ); - boolean first = true; - for ( Column column : getColumns() ) { - if ( first ) { - first = false; - } - else { - buf.append(", "); - } - buf.append( column.getQuotedName( dialect ) ); - } - return buf.append(')').toString(); - } - - @Override @Deprecated(since="6.2", forRemoval = true) - public String sqlConstraintString(SqlStringGenerationContext context, String constraintName, String defaultCatalog, String defaultSchema) { - Dialect dialect = context.getDialect(); - StringBuilder buf = new StringBuilder(); - buf.append( dialect.getAddPrimaryKeyConstraintString( constraintName ) ).append('('); - boolean first = true; - for ( Column column : getColumns() ) { - if ( first ) { - first = false; - } - else { - buf.append(", "); - } - buf.append( column.getQuotedName( dialect ) ); - } - return buf.append(')').toString(); - } - - @Deprecated(forRemoval = true) - public String generatedConstraintNamePrefix() { - return "PK_"; - } - @Override public String getExportIdentifier() { - return StringHelper.qualify( getTable().getExportIdentifier(), "PK-" + getName() ); + return qualify( getTable().getExportIdentifier(), "PK-" + getName() ); } public List getColumnsInOriginalOrder() { - if ( originalOrder == null ) { - return getColumns(); - } final List columns = getColumns(); + if ( originalOrder == null ) { + return columns; + } final Column[] columnsInOriginalOrder = new Column[columns.size()]; for ( int i = 0; i < columnsInOriginalOrder.length; i++ ) { columnsInOriginalOrder[originalOrder[i]] = columns.get( i ); @@ -124,23 +60,27 @@ public class PrimaryKey extends Constraint { } public void setOrderingUniqueKey(UniqueKey uniqueKey) { - this.orderingUniqueKey = uniqueKey; + orderingUniqueKey = uniqueKey; } public UniqueKey getOrderingUniqueKey() { - return this.orderingUniqueKey; + return orderingUniqueKey; } @Internal public void reorderColumns(List reorderedColumns) { + final List columns = getColumns(); if ( originalOrder != null ) { - assert getColumns().equals( reorderedColumns ); + assert columns.equals( reorderedColumns ); return; } - assert getColumns().size() == reorderedColumns.size() && getColumns().containsAll( reorderedColumns ); - final List columns = getColumns(); + assert columns.size() == reorderedColumns.size() && columns.containsAll( reorderedColumns ); originalOrder = new int[columns.size()]; - List newColumns = getOrderingUniqueKey() != null ? getOrderingUniqueKey().getColumns() : reorderedColumns; + final UniqueKey orderingUniqueKey = getOrderingUniqueKey(); + final List newColumns = + orderingUniqueKey != null + ? orderingUniqueKey.getColumns() + : reorderedColumns; for ( int i = 0; i < newColumns.size(); i++ ) { final Column reorderedColumn = newColumns.get( i ); originalOrder[i] = columns.indexOf( reorderedColumn ); diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Property.java b/hibernate-core/src/main/java/org/hibernate/mapping/Property.java index 4de1e16ccd..d355cd3c0e 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Property.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Property.java @@ -134,14 +134,6 @@ public class Property implements Serializable, MetaAttributable { } } - /** - * @deprecated this method is no longer used - */ - @Deprecated(since = "6", forRemoval = true) - public boolean isPrimitive(Class clazz) { - return getGetter( clazz ).getReturnTypeClass().isPrimitive(); - } - public CascadeStyle getCascadeStyle() throws MappingException { final Type type = value.getType(); if ( type.isComponentType() ) { @@ -252,15 +244,6 @@ public class Property implements Serializable, MetaAttributable { this.propertyAccessStrategy = propertyAccessStrategy; } - /** - * Approximate! - * @deprecated this method is no longer used - */ - @Deprecated(since = "6", forRemoval = true) - boolean isNullable() { - return value==null || value.isNullable(); - } - public boolean isBasicPropertyAccessor() { return propertyAccessorName==null || "property".equals( propertyAccessorName ); } @@ -371,14 +354,6 @@ public class Property implements Serializable, MetaAttributable { this.selectable = selectable; } - /** - * @deprecated this method is no longer used - */ - @Deprecated(since = "6", forRemoval = true) - public String getAccessorPropertyName(RepresentationMode mode) { - return getName(); - } - // todo : remove @Internal public Getter getGetter(Class clazz) throws MappingException { diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java index e50d834aa3..2c516b5847 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java @@ -280,14 +280,6 @@ public abstract class SimpleValue implements KeyValue { return (List) columns; } - /** - * @deprecated Use {@link #getSelectables()} instead - */ - @Deprecated(forRemoval = true, since = "6.3") - public Iterator getConstraintColumnIterator() { - return getSelectables().iterator(); - } - public String getTypeName() { return typeName; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Table.java b/hibernate-core/src/main/java/org/hibernate/mapping/Table.java index b614d0a7c1..e988475504 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Table.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Table.java @@ -325,26 +325,10 @@ public class Table implements Serializable, ContributableDatabaseObject { return unmodifiableMap( indexes ); } - /** - * @deprecated No longer used, should be removed - */ - @Deprecated(since = "6.0", forRemoval = true) - public Iterator getForeignKeyIterator() { - return getForeignKeys().values().iterator(); - } - public Map getForeignKeys() { return unmodifiableMap( foreignKeys ); } - /** - * @deprecated No longer used, should be removed - */ - @Deprecated(since = "6.0", forRemoval = true) - public Iterator getUniqueKeyIterator() { - return getUniqueKeys().values().iterator(); - } - public Map getUniqueKeys() { cleanseUniqueKeyMapIfNeeded(); return unmodifiableMap( uniqueKeys ); @@ -590,25 +574,6 @@ public class Table implements Serializable, ContributableDatabaseObject { } } - /** - * If there is one given column, mark it unique, otherwise - * create a {@link UniqueKey} comprising the given columns. - * @deprecated Use {@link #createUniqueKey(List, MetadataBuildingContext)} - */ - @Deprecated(since = "6.5", forRemoval = true) - public void createUniqueKey(List keyColumns) { - if ( keyColumns.size() == 1 ) { - keyColumns.get(0).setUnique( true ); - } - else { - String keyName = Constraint.generateName( "UK_", this, keyColumns ); - UniqueKey uniqueKey = getOrCreateUniqueKey( keyName ); - for ( Column keyColumn : keyColumns ) { - uniqueKey.addColumn( keyColumn ); - } - } - } - public UniqueKey getUniqueKey(String keyName) { return uniqueKeys.get( keyName ); } @@ -616,9 +581,8 @@ public class Table implements Serializable, ContributableDatabaseObject { public UniqueKey getOrCreateUniqueKey(String keyName) { UniqueKey uniqueKey = uniqueKeys.get( keyName ); if ( uniqueKey == null ) { - uniqueKey = new UniqueKey(); + uniqueKey = new UniqueKey( this ); uniqueKey.setName( keyName ); - uniqueKey.setTable( this ); uniqueKeys.put( keyName, uniqueKey ); } return uniqueKey; @@ -641,8 +605,7 @@ public class Table implements Serializable, ContributableDatabaseObject { ForeignKey foreignKey = foreignKeys.get( key ); if ( foreignKey == null ) { - foreignKey = new ForeignKey(); - foreignKey.setTable( this ); + foreignKey = new ForeignKey( this ); foreignKey.setReferencedEntityName( referencedEntityName ); foreignKey.setKeyDefinition( keyDefinition ); for ( Column keyColumn : keyColumns ) { @@ -775,22 +738,6 @@ public class Table implements Serializable, ContributableDatabaseObject { this.comment = comment; } - /** - * @deprecated No longer used, should be removed - */ - @Deprecated(since = "6.0", forRemoval = true) - public Iterator getCheckConstraintsIterator() { - return getCheckConstraints().iterator(); - } - - /** - * @deprecated No longer used, should be removed - */ - @Deprecated(since = "6.2", forRemoval = true) - public List getCheckConstraints() { - return checkConstraints.stream().map( CheckConstraint::getConstraint ).collect( toList() ); - } - public List getChecks() { return unmodifiableList( checkConstraints ); } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/UniqueKey.java b/hibernate-core/src/main/java/org/hibernate/mapping/UniqueKey.java index b5660e3122..c7962850c8 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/UniqueKey.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/UniqueKey.java @@ -9,10 +9,8 @@ package org.hibernate.mapping; import java.util.HashMap; import java.util.Map; -import org.hibernate.boot.model.relational.SqlStringGenerationContext; -import org.hibernate.internal.util.StringHelper; - import static org.hibernate.internal.util.StringHelper.isNotEmpty; +import static org.hibernate.internal.util.StringHelper.qualify; /** * A mapping model object representing a {@linkplain jakarta.persistence.UniqueConstraint unique key} @@ -21,19 +19,16 @@ import static org.hibernate.internal.util.StringHelper.isNotEmpty; * @author Brett Meyer */ public class UniqueKey extends Constraint { + private final Map columnOrderMap = new HashMap<>(); private boolean nameExplicit; // true when the constraint name was explicitly specified by @UniqueConstraint annotation private boolean explicit; // true when the constraint was explicitly specified by @UniqueConstraint annotation - @Override @Deprecated(since="6.2", forRemoval = true) - public String sqlConstraintString( - SqlStringGenerationContext context, - String constraintName, - String defaultCatalog, - String defaultSchema) { -// return dialect.getUniqueDelegate().uniqueConstraintSql( this ); - // Not used. - return ""; + public UniqueKey(Table table){ + setTable( table ); + } + + public UniqueKey() { } public void addColumn(Column column, String order) { @@ -47,14 +42,9 @@ public class UniqueKey extends Constraint { return columnOrderMap; } - @Deprecated(forRemoval = true) - public String generatedConstraintNamePrefix() { - return "UK_"; - } - @Override public String getExportIdentifier() { - return StringHelper.qualify( getTable().getExportIdentifier(), "UK-" + getName() ); + return qualify( getTable().getExportIdentifier(), "UK-" + getName() ); } public boolean isNameExplicit() { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java index a89d4b4926..e1a865242b 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityMappingType.java @@ -280,37 +280,6 @@ public interface EntityMappingType default void pruneForSubclasses(TableGroup tableGroup, Map entityNameUses) { } - /** - * Adapts the table group and its table reference as well as table reference joins - * in a way such that unnecessary tables or joins are omitted if possible, - * based on the given treated entity names. - * - * The goal is to e.g. remove join inheritance "branches" or union selects that are impossible. - * - * Consider the following example: - * - * class BaseEntity {} - * class Sub1 extends BaseEntity {} - * class Sub1Sub1 extends Sub1 {} - * class Sub1Sub2 extends Sub1 {} - * class Sub2 extends BaseEntity {} - * class Sub2Sub1 extends Sub2 {} - * class Sub2Sub2 extends Sub2 {} - * - * - * If the treatedEntityNames only contains Sub1 or any of its subtypes, - * this means that Sub2 and all subtypes are impossible, - * thus the joins/selects for these types shall be omitted in the given table group. - * - * @param tableGroup The table group to prune subclass tables for - * @param treatedEntityNames The entity names for which path usages were registered - * @deprecated Use {@link #pruneForSubclasses(TableGroup, Map)} instead - */ - @Deprecated(forRemoval = true) - default void pruneForSubclasses(TableGroup tableGroup, Set treatedEntityNames) { - } - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Special model parts - identifier, discriminator, etc diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java index 66eda808ae..11d72ac0af 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java @@ -295,9 +295,8 @@ public class ToOneAttributeMapping && join.getPropertySpan() == 1 && join.getTable() == manyToOne.getTable() && equal( join.getKey(), manyToOne ) ) { - //noinspection deprecation bidirectionalAttributeName = SelectablePath.parse( - join.getPropertyIterator().next().getName() + join.getProperties().get(0).getName() ); hasJoinTable = true; break; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java index 8dfb890655..6d6dd7a905 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java @@ -918,19 +918,6 @@ public abstract class AbstractCollectionPersister return elementClass; } - /** - * @deprecated No longer used. - */ - @Deprecated(forRemoval = true) - @Remove - protected Object decrementIndexByBase(Object index) { - final int baseIndex = attributeMapping.getIndexMetadata().getListIndexBase(); - if ( baseIndex > 0 ) { - index = (Integer)index - baseIndex; - } - return index; - } - protected Object incrementIndexByBase(Object index) { final int baseIndex = attributeMapping.getIndexMetadata().getListIndexBase(); if ( baseIndex > 0 ) { diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 6a8c27c729..723329292e 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -2859,14 +2859,6 @@ public abstract class AbstractEntityPersister return tableMappings; } - /** - * @deprecated this method is no longer used - */ - @Deprecated(since = "6", forRemoval = true) - public int getTableMappingsCount() { - return tableMappings.length; - } - public EntityTableMapping getTableMapping(int i) { return tableMappings[i]; } @@ -2961,14 +2953,6 @@ public abstract class AbstractEntityPersister deleteCoordinator.delete( object, id, version, session ); } - /** - * @deprecated this method is no longer used - */ - @Deprecated(since = "6", forRemoval = true) - protected boolean isAllOrDirtyOptLocking() { - return entityMetamodel.getOptimisticLockStyle().isAllOrDirty(); - } - protected void logStaticSQL() { if ( LOG.isDebugEnabled() ) { LOG.debugf( "Static SQL for entity: %s", getEntityName() ); @@ -6365,316 +6349,8 @@ public abstract class AbstractEntityPersister return hasPartitionedSelectionMapping; } - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // Deprecations - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - /** - * @deprecated With no replacement - * - * @see #getInsertCoordinator() - * @see #tableMappings - * @see EntityTableMapping#isInsertCallable() - */ - @Deprecated( since = "6", forRemoval = true ) - public boolean isInsertCallable(int j) { - return tableMappings[j].isInsertCallable(); - } - - /** - * @deprecated With no replacement - * - * @see #getUpdateCoordinator() - * @see #tableMappings - * @see EntityTableMapping#isUpdateCallable() - */ - @Deprecated( since = "6", forRemoval = true ) - public boolean isUpdateCallable(int j) { - return tableMappings[j].isUpdateCallable(); - } - - /** - * @deprecated With no replacement - * - * @see #getDeleteCoordinator() - * @see #tableMappings - * @see EntityTableMapping#isDeleteCallable() - */ - @Deprecated( since = "6", forRemoval = true ) - public boolean isDeleteCallable(int j) { - return tableMappings[j].isDeleteCallable(); - } - - /** - * @deprecated With no replacement - */ - @Deprecated( since = "6", forRemoval = true ) - protected boolean isSubclassTableSequentialSelect(int j) { - return false; - } - - /** - * @deprecated With no replacement. - */ - @Deprecated( since = "6", forRemoval = true ) - public EntityMappingType getElementTypeDescriptor() { - return this; - } - - - - /** - * @deprecated No longer used - */ - @Deprecated( forRemoval = true ) - @Remove public abstract boolean isTableCascadeDeleteEnabled(int j); - /** - * @deprecated No longer used - */ - @Deprecated(forRemoval = true) - @Remove - protected boolean isInverseSubclassTable(int j) { - return false; - } - - /** - * @deprecated No longer used. See {@link #getDeleteCoordinator()} - */ - @Deprecated(forRemoval = true) - @Remove - public String[] getSQLDeleteStrings() { - return extractSqlStrings( deleteCoordinator.getStaticMutationOperationGroup() ); - } - - private String[] extractSqlStrings(MutationOperationGroup operationGroup) { - final int numberOfOperations = operationGroup.getNumberOfOperations(); - final String[] strings = new String[numberOfOperations]; - for ( int i = 0; i < numberOfOperations; i++ ) { - final MutationOperation operation = operationGroup.getOperation( i ); - if ( operation instanceof JdbcOperation ) { - strings[i] = ( (JdbcOperation) operation ).getSqlString(); - } - } - return strings; - } - - - /** - * @deprecated No longer used. See {@link #getUpdateCoordinator()} - */ - @Deprecated(forRemoval = true) - @Remove - public String[] getSQLUpdateStrings() { - return extractSqlStrings( updateCoordinator.getStaticMutationOperationGroup() ); - } - - /** - * Decide which tables need to be updated. - *

- * The return here is an array of boolean values with each index corresponding - * to a given table in the scope of this persister. - * - * @param dirtyProperties The indices of all the entity properties considered dirty. - * @param hasDirtyCollection Whether any collections owned by the entity which were considered dirty. - * - * @return Array of booleans indicating which table require updating. - * - * @deprecated No longer used. See {@link UpdateCoordinator} - */ - @Deprecated(forRemoval = true) - @Remove - public boolean[] getTableUpdateNeeded(final int[] dirtyProperties, boolean hasDirtyCollection) { - if ( dirtyProperties == null ) { - return getTableHasColumns(); // for objects that came in via update() - } - else { - boolean[] updateability = getPropertyUpdateability(); - int[] propertyTableNumbers = getPropertyTableNumbers(); - boolean[] tableUpdateNeeded = new boolean[getTableSpan()]; - for ( int property : dirtyProperties ) { - int table = propertyTableNumbers[property]; - tableUpdateNeeded[table] = tableUpdateNeeded[table] - || getPropertyColumnSpan( property ) > 0 && updateability[property]; - if ( getPropertyColumnSpan( property ) > 0 && !updateability[property] ) { - LOG.ignoreImmutablePropertyModification( getPropertyNames()[property], getEntityName() ); - } - } - if ( isVersioned() ) { - tableUpdateNeeded[0] = tableUpdateNeeded[0] - || isVersionIncrementRequired( dirtyProperties, hasDirtyCollection, getPropertyVersionability() ); - } - return tableUpdateNeeded; - } - } - - /** - * @deprecated No longer used. See {@link MutationExecutorService} - */ - @Deprecated(forRemoval = true) - @Remove - public boolean isBatchable() { - return optimisticLockStyle().isNone() - || !isVersioned() && optimisticLockStyle().isVersion() - || getFactory().getSessionFactoryOptions().isJdbcBatchVersionedData(); - } - - /** - * Generate the SQL that deletes a row by id (and version) - * - * @deprecated No longer used. See {@link DeleteCoordinatorStandard} - */ - @Deprecated(forRemoval = true) - @Remove - public String generateDeleteString(int j) { - final Delete delete = new Delete( getFactory() ) - .setTableName( getTableName( j ) ) - .addColumnRestriction( getKeyColumns( j ) ); - if ( j == 0 ) { - delete.setVersionColumnName( getVersionColumnName() ); - } - if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { - delete.setComment( "delete " + getEntityName() ); - } - return delete.toStatementString(); - } - - /** - * Marshall the fields of a persistent instance to a prepared statement - * - * @deprecated No longer used. - */ - @Deprecated(forRemoval = true) - @Remove - public int dehydrate( - final Object id, - final Object[] fields, - final Object rowId, - final boolean[] includeProperty, - final boolean[][] includeColumns, - final int j, - final PreparedStatement ps, - final SharedSessionContractImplementor session, - int index, - boolean isUpdate) throws SQLException, HibernateException { - - if ( LOG.isTraceEnabled() ) { - LOG.tracev( "Dehydrating entity: {0}", infoString( this, id, getFactory() ) ); - } - - for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) { - if ( includeProperty[i] && isPropertyOfTable( i, j ) - && !lobProperties.contains( i ) ) { - getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session ); - index += ArrayHelper.countTrue( includeColumns[i] ); //TODO: this is kinda slow... - } - } - - if ( !isUpdate ) { - index += dehydrateId( id, rowId, ps, session, index ); - } - - // HHH-4635 - // Oracle expects all Lob properties to be last in inserts - // and updates. Insert them at the end. - for ( int i : lobProperties ) { - if ( includeProperty[i] && isPropertyOfTable( i, j ) ) { - getPropertyTypes()[i].nullSafeSet( ps, fields[i], index, includeColumns[i], session ); - index += ArrayHelper.countTrue( includeColumns[i] ); //TODO: this is kinda slow... - } - } - - if ( isUpdate ) { - index += dehydrateId( id, rowId, ps, session, index ); - } - - return index; - - } - - private int dehydrateId( - final Object id, - final Object rowId, - final PreparedStatement ps, - final SharedSessionContractImplementor session, - int index) throws SQLException { - if ( rowId != null ) { - if ( LOG.isTraceEnabled() ) { - LOG.tracev( - String.format( - "binding parameter [%s] as ROWID - [%s]", - index, - rowId - ) - ); - } - - ps.setObject( index, rowId ); - return 1; - } - else if ( id != null ) { - getIdentifierType().nullSafeSet( ps, id, index, session ); - return getIdentifierColumnSpan(); - } - return 0; - } - - @Deprecated( since = "6.2", forRemoval = true ) - @Remove - protected String[] generateSQLDeleteStrings(Object[] loadedState) { - int span = getTableSpan(); - String[] deleteStrings = new String[span]; - for ( int j = span - 1; j >= 0; j-- ) { - final Delete delete = new Delete( getFactory() ) - .setTableName( getTableName( j ) ) - .addColumnRestriction( getKeyColumns( j ) ); - if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { - delete.setComment( "delete " + getEntityName() + " [" + j + "]" ); - } - - boolean[] versionability = getPropertyVersionability(); - Type[] types = getPropertyTypes(); - for ( int i = 0; i < entityMetamodel.getPropertySpan(); i++ ) { - if ( isPropertyOfTable( i, j ) && versionability[i] ) { - // this property belongs to the table and it is not specifically - // excluded from optimistic locking by optimistic-lock="false" - String[] propertyColumnNames = getPropertyColumnNames( i ); - boolean[] propertyNullness = types[i].toColumnNullness( loadedState[i], getFactory() ); - for ( int k = 0; k < propertyNullness.length; k++ ) { - if ( propertyNullness[k] ) { - delete.addColumnRestriction( propertyColumnNames[k] ); - } - else { - delete.addColumnIsNullRestriction( propertyColumnNames[k] ); - } - } - } - } - deleteStrings[j] = delete.toStatementString(); - } - return deleteStrings; - } - - @Deprecated( since = "6.2", forRemoval = true ) - @Remove - public final boolean isAllNull(Object[] array, int tableNumber) { - for ( int i = 0; i < array.length; i++ ) { - if ( isPropertyOfTable( i, tableNumber ) && array[i] != null ) { - return false; - } - } - return true; - } - - - - - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index d7e88fe0c5..b6133e075d 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -760,11 +760,6 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { return subclassTableNameClosure[subclassPropertyTableNumberClosure[i]]; } - @Override - protected boolean isInverseSubclassTable(int j) { - return isInverseSubclassTable[j]; - } - @Override protected boolean isNullableSubclassTable(int j) { return isNullableSubclassTable[j]; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java index aa48bd8769..32a6f75258 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java @@ -395,11 +395,6 @@ public class SingleTableEntityPersister extends AbstractEntityPersister { return isInverseTable[j]; } - @Override - protected boolean isInverseSubclassTable(int j) { - return isInverseSubclassTable[j]; - } - @Override public String getDiscriminatorColumnName() { return discriminatorColumnName; diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java index b45a3fa9bd..5c180cdc4a 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java @@ -46,7 +46,6 @@ import org.hibernate.metamodel.mapping.EntityMappingType; import org.hibernate.metamodel.mapping.SelectableConsumer; import org.hibernate.metamodel.mapping.SelectableMapping; import org.hibernate.metamodel.mapping.TableDetails; -import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess; import org.hibernate.metamodel.spi.MappingMetamodelImplementor; import org.hibernate.metamodel.spi.RuntimeModelCreationContext; import org.hibernate.persister.spi.PersisterCreationContext; diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/FunctionRenderingSupport.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/FunctionRenderingSupport.java index 523b41f0fe..d4418d7a68 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/FunctionRenderingSupport.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/FunctionRenderingSupport.java @@ -34,48 +34,6 @@ public interface FunctionRenderingSupport { List sqlAstArguments, SqlAstTranslator walker); - /** - * @deprecated Use {@link #render(SqlAppender, List, Predicate, ReturnableType, SqlAstTranslator)} instead - */ - @Deprecated(forRemoval = true) - default void render( - SqlAppender sqlAppender, - List sqlAstArguments, - Predicate filter, - SqlAstTranslator walker) { - // Ignore the filter by default. Subclasses will override this - render( sqlAppender, sqlAstArguments, walker ); - } - - /** - * @deprecated Use {@link #render(SqlAppender, List, Predicate, List, ReturnableType, SqlAstTranslator)} instead - */ - @Deprecated(forRemoval = true) - default void render( - SqlAppender sqlAppender, - List sqlAstArguments, - Predicate filter, - List withinGroup, - SqlAstTranslator walker) { - // Ignore the filter by default. Subclasses will override this - render( sqlAppender, sqlAstArguments, walker ); - } - - /** - * @deprecated Use {@link #render(SqlAppender, List, Predicate, Boolean, Boolean, ReturnableType, SqlAstTranslator)} instead - */ - @Deprecated(forRemoval = true) - default void render( - SqlAppender sqlAppender, - List sqlAstArguments, - Predicate filter, - Boolean respectNulls, - Boolean fromFirst, - SqlAstTranslator walker) { - // Ignore the filter by default. Subclasses will override this - render( sqlAppender, sqlAstArguments, walker ); - } - /** * @since 6.4 */ diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingAggregateFunctionSqlAstExpression.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingAggregateFunctionSqlAstExpression.java index 021db6a32d..ea169d784d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingAggregateFunctionSqlAstExpression.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingAggregateFunctionSqlAstExpression.java @@ -28,21 +28,6 @@ public class SelfRenderingAggregateFunctionSqlAstExpression extends SelfRenderin private final Predicate filter; - /** - * @deprecated Use {@link #SelfRenderingAggregateFunctionSqlAstExpression(String, FunctionRenderer, List, Predicate, ReturnableType, JdbcMappingContainer)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingAggregateFunctionSqlAstExpression( - String functionName, - FunctionRenderingSupport renderer, - List sqlAstArguments, - Predicate filter, - ReturnableType type, - JdbcMappingContainer expressible) { - super( functionName, renderer, sqlAstArguments, type, expressible ); - this.filter = filter; - } - public SelfRenderingAggregateFunctionSqlAstExpression( String functionName, FunctionRenderer renderer, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingFunctionSqlAstExpression.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingFunctionSqlAstExpression.java index 4abd0f7328..1094685c80 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingFunctionSqlAstExpression.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingFunctionSqlAstExpression.java @@ -49,24 +49,6 @@ public class SelfRenderingFunctionSqlAstExpression private final @Nullable ReturnableType type; private final @Nullable JdbcMappingContainer expressible; - /** - * @deprecated Use {@link #SelfRenderingFunctionSqlAstExpression(String, FunctionRenderer, List, ReturnableType, JdbcMappingContainer)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingFunctionSqlAstExpression( - String functionName, - FunctionRenderingSupport renderer, - List sqlAstArguments, - @Nullable ReturnableType type, - @Nullable JdbcMappingContainer expressible) { - this.functionName = functionName; - this.renderer = renderer::render; - this.sqlAstArguments = sqlAstArguments; - this.type = type; - //might be null due to code in SelfRenderingFunctionSqlAstExpression - this.expressible = expressible; - } - public SelfRenderingFunctionSqlAstExpression( String functionName, FunctionRenderer renderer, @@ -98,14 +80,6 @@ public class SelfRenderingFunctionSqlAstExpression : expressible; } - /** - * @deprecated Use {@link #getFunctionRenderer()} instead - */ - @Deprecated(forRemoval = true) - protected FunctionRenderingSupport getRenderer() { - return renderer; - } - protected FunctionRenderer getFunctionRenderer() { return renderer; } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingOrderedSetAggregateFunctionSqlAstExpression.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingOrderedSetAggregateFunctionSqlAstExpression.java index c5556daa54..bf7bd2119f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingOrderedSetAggregateFunctionSqlAstExpression.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingOrderedSetAggregateFunctionSqlAstExpression.java @@ -29,22 +29,6 @@ public class SelfRenderingOrderedSetAggregateFunctionSqlAstExpression extends Se private final List withinGroup; - /** - * @deprecated Use {@link #SelfRenderingOrderedSetAggregateFunctionSqlAstExpression(String, FunctionRenderer, List, Predicate, List, ReturnableType, JdbcMappingContainer)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingOrderedSetAggregateFunctionSqlAstExpression( - String functionName, - FunctionRenderingSupport renderer, - List sqlAstArguments, - Predicate filter, - List withinGroup, - ReturnableType type, - JdbcMappingContainer expressible) { - super( functionName, renderer, sqlAstArguments, filter, type, expressible ); - this.withinGroup = withinGroup; - } - public SelfRenderingOrderedSetAggregateFunctionSqlAstExpression( String functionName, FunctionRenderer renderer, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmAggregateFunction.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmAggregateFunction.java index e60c930cc3..7e0c436331 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmAggregateFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmAggregateFunction.java @@ -30,24 +30,6 @@ public class SelfRenderingSqmAggregateFunction extends SelfRenderingSqmFuncti private final SqmPredicate filter; - /** - * @deprecated Use {@link #SelfRenderingSqmAggregateFunction(SqmFunctionDescriptor, FunctionRenderer, List, SqmPredicate, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingSqmAggregateFunction( - SqmFunctionDescriptor descriptor, - FunctionRenderingSupport renderingSupport, - List> arguments, - SqmPredicate filter, - ReturnableType impliedResultType, - ArgumentsValidator argumentsValidator, - FunctionReturnTypeResolver returnTypeResolver, - NodeBuilder nodeBuilder, - String name) { - super( descriptor, renderingSupport, arguments, impliedResultType, argumentsValidator, returnTypeResolver, nodeBuilder, name ); - this.filter = filter; - } - public SelfRenderingSqmAggregateFunction( SqmFunctionDescriptor descriptor, FunctionRenderer renderer, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmFunction.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmFunction.java index ab8e59bf2f..d8fb2c371a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmFunction.java @@ -38,31 +38,9 @@ public class SelfRenderingSqmFunction extends SqmFunction { private final @Nullable ReturnableType impliedResultType; private final @Nullable ArgumentsValidator argumentsValidator; private final FunctionReturnTypeResolver returnTypeResolver; - private final FunctionRenderingSupport renderingSupport; private final FunctionRenderer renderer; private @Nullable ReturnableType resultType; - /** - * @deprecated Use {@link #SelfRenderingSqmFunction(SqmFunctionDescriptor, FunctionRenderer, List, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingSqmFunction( - SqmFunctionDescriptor descriptor, - FunctionRenderingSupport renderingSupport, - List> arguments, - @Nullable ReturnableType impliedResultType, - @Nullable ArgumentsValidator argumentsValidator, - FunctionReturnTypeResolver returnTypeResolver, - NodeBuilder nodeBuilder, - String name) { - super( name, descriptor, impliedResultType, arguments, nodeBuilder ); - this.renderingSupport = renderingSupport; - this.renderer = renderingSupport::render; - this.impliedResultType = impliedResultType; - this.argumentsValidator = argumentsValidator; - this.returnTypeResolver = returnTypeResolver; - } - public SelfRenderingSqmFunction( SqmFunctionDescriptor descriptor, FunctionRenderer renderer, @@ -73,7 +51,6 @@ public class SelfRenderingSqmFunction extends SqmFunction { NodeBuilder nodeBuilder, String name) { super( name, descriptor, impliedResultType, arguments, nodeBuilder ); - this.renderingSupport = renderer; this.renderer = renderer; this.impliedResultType = impliedResultType; this.argumentsValidator = argumentsValidator; @@ -107,14 +84,6 @@ public class SelfRenderingSqmFunction extends SqmFunction { return expression; } - /** - * @deprecated Use {@link #getFunctionRenderer()} instead - */ - @Deprecated(forRemoval = true) - public FunctionRenderingSupport getRenderingSupport() { - return renderingSupport; - } - public FunctionRenderer getFunctionRenderer() { return renderer; } @@ -195,11 +164,6 @@ public class SelfRenderingSqmFunction extends SqmFunction { return nodeType; } - @Deprecated(forRemoval = true) - protected @Nullable ReturnableType resolveResultType(TypeConfiguration typeConfiguration) { - return resolveResultType( () -> null, typeConfiguration ); - } - public @Nullable ReturnableType resolveResultType(SqmToSqlAstConverter walker) { if ( resultType == null ) { resultType = determineResultType( @@ -222,22 +186,6 @@ public class SelfRenderingSqmFunction extends SqmFunction { ); } - @Deprecated(forRemoval = true) - protected @Nullable ReturnableType resolveResultType( - Supplier> inferredTypeSupplier, - TypeConfiguration typeConfiguration) { - if ( resultType == null ) { - resultType = returnTypeResolver.resolveFunctionReturnType( - impliedResultType, - inferredTypeSupplier, - getArguments(), - typeConfiguration - ); - setExpressibleType( resultType ); - } - return resultType; - } - protected MappingModelExpressible getMappingModelExpressible( SqmToSqlAstConverter walker, ReturnableType resultType, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmOrderedSetAggregateFunction.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmOrderedSetAggregateFunction.java index 6a23fcf5c7..53d871da8f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmOrderedSetAggregateFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmOrderedSetAggregateFunction.java @@ -35,35 +35,6 @@ public class SelfRenderingSqmOrderedSetAggregateFunction extends SelfRenderin private final SqmOrderByClause withinGroup; - /** - * @deprecated Use {@link #SelfRenderingSqmOrderedSetAggregateFunction(SqmFunctionDescriptor, FunctionRenderer, List, SqmPredicate, SqmOrderByClause, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingSqmOrderedSetAggregateFunction( - SqmFunctionDescriptor descriptor, - FunctionRenderingSupport renderingSupport, - List> arguments, - SqmPredicate filter, - SqmOrderByClause withinGroupClause, - ReturnableType impliedResultType, - ArgumentsValidator argumentsValidator, - FunctionReturnTypeResolver returnTypeResolver, - NodeBuilder nodeBuilder, - String name) { - super( - descriptor, - renderingSupport, - arguments, - filter, - impliedResultType, - argumentsValidator, - returnTypeResolver, - nodeBuilder, - name - ); - this.withinGroup = withinGroupClause; - } - public SelfRenderingSqmOrderedSetAggregateFunction( SqmFunctionDescriptor descriptor, FunctionRenderer renderer, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmWindowFunction.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmWindowFunction.java index fd0287bdae..fce709eb71 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmWindowFunction.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingSqmWindowFunction.java @@ -32,28 +32,6 @@ public class SelfRenderingSqmWindowFunction extends SelfRenderingSqmFunction< private final Boolean respectNulls; private final Boolean fromFirst; - /** - * @deprecated Use {@link #SelfRenderingSqmWindowFunction(SqmFunctionDescriptor, FunctionRenderer, List, SqmPredicate, Boolean, Boolean, ReturnableType, ArgumentsValidator, FunctionReturnTypeResolver, NodeBuilder, String)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingSqmWindowFunction( - SqmFunctionDescriptor descriptor, - FunctionRenderingSupport renderingSupport, - List> arguments, - SqmPredicate filter, - Boolean respectNulls, - Boolean fromFirst, - ReturnableType impliedResultType, - ArgumentsValidator argumentsValidator, - FunctionReturnTypeResolver returnTypeResolver, - NodeBuilder nodeBuilder, - String name) { - super( descriptor, renderingSupport, arguments, impliedResultType, argumentsValidator, returnTypeResolver, nodeBuilder, name ); - this.filter = filter; - this.respectNulls = respectNulls; - this.fromFirst = fromFirst; - } - public SelfRenderingSqmWindowFunction( SqmFunctionDescriptor descriptor, FunctionRenderer renderer, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingWindowFunctionSqlAstExpression.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingWindowFunctionSqlAstExpression.java index 2f233fef5e..6a12bf8f28 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingWindowFunctionSqlAstExpression.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/function/SelfRenderingWindowFunctionSqlAstExpression.java @@ -30,25 +30,6 @@ public class SelfRenderingWindowFunctionSqlAstExpression extends SelfRenderingFu private final Boolean respectNulls; private final Boolean fromFirst; - /** - * @deprecated Use {@link #SelfRenderingWindowFunctionSqlAstExpression(String, FunctionRenderer, List, Predicate, Boolean, Boolean, ReturnableType, JdbcMappingContainer)} instead - */ - @Deprecated(forRemoval = true) - public SelfRenderingWindowFunctionSqlAstExpression( - String functionName, - FunctionRenderingSupport renderer, - List sqlAstArguments, - Predicate filter, - Boolean respectNulls, - Boolean fromFirst, - ReturnableType type, - JdbcMappingContainer expressible) { - super( functionName, renderer, sqlAstArguments, type, expressible ); - this.filter = filter; - this.respectNulls = respectNulls; - this.fromFirst = fromFirst; - } - public SelfRenderingWindowFunctionSqlAstExpression( String functionName, FunctionRenderer renderer, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java index 19c6eb6cfc..cefce8146a 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/QuerySqmImpl.java @@ -25,7 +25,6 @@ import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.LockOptions; import org.hibernate.ScrollMode; -import org.hibernate.engine.query.spi.EntityGraphQueryHint; import org.hibernate.engine.spi.LoadQueryInfluencers; import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.generator.Generator; @@ -972,10 +971,6 @@ public class QuerySqmImpl return (T) getQueryOptions().getAppliedGraph(); } - if ( EntityGraphQueryHint.class.isAssignableFrom( cls ) ) { - return (T) new EntityGraphQueryHint( getQueryOptions().getAppliedGraph() ); - } - throw new PersistenceException( "Unrecognized unwrap type [" + cls.getName() + "]" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java index a6b0c55e1d..72ec899e22 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/internal/SqmCriteriaNodeBuilder.java @@ -580,7 +580,7 @@ public class SqmCriteriaNodeBuilder implements NodeBuilder, SqmCreationContext, throw new FunctionArgumentException( "Path '" + path + "' does not refer to a single-valued association" ); } - return new SqmFkExpression<>( (SqmEntityValuedSimplePath) path, this ); + return new SqmFkExpression<>( (SqmEntityValuedSimplePath) path ); } @Override diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/FunctionReturnTypeResolver.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/FunctionReturnTypeResolver.java index 8fb1fa934e..bb7a7d770d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/FunctionReturnTypeResolver.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/produce/function/FunctionReturnTypeResolver.java @@ -26,25 +26,6 @@ import org.checkerframework.checker.nullness.qual.Nullable; * @author Steve Ebersole */ public interface FunctionReturnTypeResolver { - /** - * Resolve the return type for a function given its context-implied type and - * the arguments to this call. - *

- * The context-implied type is the type implied by where the function - * occurs in the query. E.g., for an equality predicate (`something = some_function`) - * the implied type of the return from `some_function` would be defined by the type - * of `some_function`. - * - * @return The resolved type. - * @deprecated Use {@link #resolveFunctionReturnType(ReturnableType, SqmToSqlAstConverter, List, TypeConfiguration)} instead - */ - @Deprecated(forRemoval = true) - default @Nullable ReturnableType resolveFunctionReturnType( - ReturnableType impliedType, - List> arguments, - TypeConfiguration typeConfiguration) { - throw new UnsupportedOperationException( "Not implemented for " + getClass().getName() ); - } /** * Resolve the return type for a function given its context-implied type and diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/SqmTranslatorFactory.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/SqmTranslatorFactory.java index 1ce1c4f54d..1c0a8d61ae 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/SqmTranslatorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/SqmTranslatorFactory.java @@ -43,71 +43,4 @@ public interface SqmTranslatorFactory { QueryParameterBindings domainParameterBindings, LoadQueryInfluencers loadQueryInfluencers, SqlAstCreationContext creationContext); - - /** - * @deprecated Use {@link #createMutationTranslator(SqmDmlStatement, QueryOptions, DomainParameterXref, QueryParameterBindings, LoadQueryInfluencers, SqlAstCreationContext)} instead - */ - @Deprecated(forRemoval = true) - default SqmTranslator createSimpleDeleteTranslator( - SqmDeleteStatement sqmDeleteStatement, - QueryOptions queryOptions, - DomainParameterXref domainParameterXref, - QueryParameterBindings domainParameterBindings, - LoadQueryInfluencers loadQueryInfluencers, - SqlAstCreationContext creationContext) { - //noinspection unchecked - return (SqmTranslator) createMutationTranslator( - sqmDeleteStatement, - queryOptions, - domainParameterXref, - domainParameterBindings, - loadQueryInfluencers, - creationContext - ); - } - - /** - * @deprecated Use {@link #createMutationTranslator(SqmDmlStatement, QueryOptions, DomainParameterXref, QueryParameterBindings, LoadQueryInfluencers, SqlAstCreationContext)} instead - */ - @Deprecated(forRemoval = true) - default SqmTranslator createInsertTranslator( - SqmInsertStatement sqmInsertStatement, - QueryOptions queryOptions, - DomainParameterXref domainParameterXref, - QueryParameterBindings domainParameterBindings, - LoadQueryInfluencers loadQueryInfluencers, - SqlAstCreationContext creationContext) { - //noinspection unchecked - return (SqmTranslator) createMutationTranslator( - sqmInsertStatement, - queryOptions, - domainParameterXref, - domainParameterBindings, - loadQueryInfluencers, - creationContext - ); - } - - /** - * @deprecated Use {@link #createMutationTranslator(SqmDmlStatement, QueryOptions, DomainParameterXref, QueryParameterBindings, LoadQueryInfluencers, SqlAstCreationContext)} instead - */ - @Deprecated(forRemoval = true) - default SqmTranslator createSimpleUpdateTranslator( - SqmUpdateStatement sqmUpdateStatement, - QueryOptions queryOptions, - DomainParameterXref domainParameterXref, - QueryParameterBindings domainParameterBindings, - LoadQueryInfluencers loadQueryInfluencers, - SqlAstCreationContext creationContext) { - //noinspection unchecked - return (SqmTranslator) createMutationTranslator( - sqmUpdateStatement, - queryOptions, - domainParameterXref, - domainParameterBindings, - loadQueryInfluencers, - creationContext - ); - } - } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/StandardSqmTranslatorFactory.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/StandardSqmTranslatorFactory.java index 14e7a2ab38..0d53904071 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/StandardSqmTranslatorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/StandardSqmTranslatorFactory.java @@ -12,16 +12,10 @@ import org.hibernate.query.spi.QueryParameterBindings; import org.hibernate.query.sqm.internal.DomainParameterXref; import org.hibernate.query.sqm.sql.internal.StandardSqmTranslator; import org.hibernate.query.sqm.tree.SqmDmlStatement; -import org.hibernate.query.sqm.tree.delete.SqmDeleteStatement; -import org.hibernate.query.sqm.tree.insert.SqmInsertStatement; import org.hibernate.query.sqm.tree.select.SqmSelectStatement; -import org.hibernate.query.sqm.tree.update.SqmUpdateStatement; import org.hibernate.sql.ast.spi.SqlAstCreationContext; import org.hibernate.sql.ast.tree.MutationStatement; -import org.hibernate.sql.ast.tree.delete.DeleteStatement; -import org.hibernate.sql.ast.tree.insert.InsertStatement; import org.hibernate.sql.ast.tree.select.SelectStatement; -import org.hibernate.sql.ast.tree.update.UpdateStatement; /** * Standard implementation of the SqmTranslatorFactory @@ -68,61 +62,4 @@ public class StandardSqmTranslatorFactory implements SqmTranslatorFactory { false ); } - - @Override - public SqmTranslator createSimpleDeleteTranslator( - SqmDeleteStatement sqmDeleteStatement, - QueryOptions queryOptions, - DomainParameterXref domainParameterXref, - QueryParameterBindings domainParameterBindings, - LoadQueryInfluencers loadQueryInfluencers, - SqlAstCreationContext creationContext) { - return new StandardSqmTranslator<>( - sqmDeleteStatement, - queryOptions, - domainParameterXref, - domainParameterBindings, - loadQueryInfluencers, - creationContext, - false - ); - } - - @Override - public SqmTranslator createInsertTranslator( - SqmInsertStatement sqmInsertStatement, - QueryOptions queryOptions, - DomainParameterXref domainParameterXref, - QueryParameterBindings domainParameterBindings, - LoadQueryInfluencers loadQueryInfluencers, - SqlAstCreationContext creationContext) { - return new StandardSqmTranslator<>( - sqmInsertStatement, - queryOptions, - domainParameterXref, - domainParameterBindings, - loadQueryInfluencers, - creationContext, - false - ); - } - - @Override - public SqmTranslator createSimpleUpdateTranslator( - SqmUpdateStatement sqmUpdateStatement, - QueryOptions queryOptions, - DomainParameterXref domainParameterXref, - QueryParameterBindings domainParameterBindings, - LoadQueryInfluencers loadQueryInfluencers, - SqlAstCreationContext creationContext) { - return new StandardSqmTranslator<>( - sqmUpdateStatement, - queryOptions, - domainParameterXref, - domainParameterBindings, - loadQueryInfluencers, - creationContext, - false - ); - } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java index c082a0b953..e7bbd827c9 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/delete/SqmDeleteStatement.java @@ -8,7 +8,6 @@ package org.hibernate.query.sqm.tree.delete; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; import org.hibernate.query.criteria.JpaCriteriaDelete; import org.hibernate.query.sqm.NodeBuilder; @@ -19,12 +18,10 @@ import org.hibernate.query.sqm.tree.SqmCopyContext; import org.hibernate.query.sqm.tree.SqmDeleteOrUpdateStatement; import org.hibernate.query.sqm.tree.cte.SqmCteStatement; import org.hibernate.query.sqm.tree.expression.SqmParameter; -import org.hibernate.query.sqm.tree.expression.ValueBindJpaCriteriaParameter; import org.hibernate.query.sqm.tree.from.SqmFromClause; import org.hibernate.query.sqm.tree.from.SqmRoot; import jakarta.persistence.criteria.Expression; -import jakarta.persistence.criteria.ParameterExpression; import jakarta.persistence.criteria.Predicate; import org.checkerframework.checker.nullness.qual.Nullable; import jakarta.persistence.criteria.Subquery; @@ -41,31 +38,6 @@ public class SqmDeleteStatement super( SqmQuerySource.HQL, nodeBuilder ); } - /** - * @deprecated was previously used for HQL. Use {@link SqmDeleteStatement#SqmDeleteStatement(NodeBuilder)} instead - */ - @Deprecated(forRemoval = true) - public SqmDeleteStatement(SqmRoot target, SqmQuerySource querySource, NodeBuilder nodeBuilder) { - super( target, querySource, nodeBuilder ); - } - - /** - * @deprecated was previously used for Criteria. Use {@link SqmDeleteStatement#SqmDeleteStatement(Class,NodeBuilder)} instead - */ - @Deprecated(forRemoval = true) - public SqmDeleteStatement(Class targetEntity, SqmQuerySource querySource, NodeBuilder nodeBuilder) { - super( - new SqmRoot<>( - nodeBuilder.getDomainModel().entity( targetEntity ), - null, - false, - nodeBuilder - ), - querySource, - nodeBuilder - ); - } - public SqmDeleteStatement(Class targetEntity, NodeBuilder nodeBuilder) { super( new SqmRoot<>( diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmFkExpression.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmFkExpression.java index dc1b739b7c..0755432253 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmFkExpression.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/domain/SqmFkExpression.java @@ -10,11 +10,9 @@ import org.hibernate.metamodel.mapping.ForeignKeyDescriptor; import org.hibernate.metamodel.model.domain.EntityDomainType; import org.hibernate.metamodel.model.domain.IdentifiableDomainType; import org.hibernate.query.hql.spi.SqmCreationState; -import org.hibernate.query.sqm.NodeBuilder; import org.hibernate.query.sqm.SemanticQueryWalker; import org.hibernate.query.sqm.SqmPathSource; import org.hibernate.query.sqm.TreatException; -import org.hibernate.query.sqm.produce.function.FunctionArgumentException; import org.hibernate.query.sqm.tree.SqmCopyContext; import org.hibernate.spi.NavigablePath; @@ -26,14 +24,6 @@ import org.hibernate.spi.NavigablePath; */ public class SqmFkExpression extends AbstractSqmPath { - /** - * @deprecated Use {@link #SqmFkExpression(SqmEntityValuedSimplePath)} instead. - */ - @Deprecated(forRemoval = true) - public SqmFkExpression(SqmEntityValuedSimplePath toOnePath, NodeBuilder criteriaBuilder) { - this( toOnePath ); - } - public SqmFkExpression(SqmEntityValuedSimplePath toOnePath) { this( toOnePath.getNavigablePath().append( ForeignKeyDescriptor.PART_NAME ), toOnePath ); } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/AbstractSqmInsertStatement.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/AbstractSqmInsertStatement.java index 889e7d6add..ebe84ed55e 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/AbstractSqmInsertStatement.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/insert/AbstractSqmInsertStatement.java @@ -44,25 +44,10 @@ public abstract class AbstractSqmInsertStatement extends AbstractSqmDmlStatem private List> insertionTargetPaths; private @Nullable SqmConflictClause conflictClause; - protected AbstractSqmInsertStatement(SqmQuerySource querySource, NodeBuilder nodeBuilder) { - super( querySource, nodeBuilder ); - } - protected AbstractSqmInsertStatement(SqmRoot targetRoot, SqmQuerySource querySource, NodeBuilder nodeBuilder) { super( targetRoot, querySource, nodeBuilder ); } - @Deprecated(forRemoval = true) - protected AbstractSqmInsertStatement( - NodeBuilder builder, - SqmQuerySource querySource, - Set> parameters, - Map> cteStatements, - SqmRoot target, - List> insertionTargetPaths) { - this( builder, querySource, parameters, cteStatements, target, insertionTargetPaths, null ); - } - protected AbstractSqmInsertStatement( NodeBuilder builder, SqmQuerySource querySource, diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/AbstractSqmSelectQuery.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/AbstractSqmSelectQuery.java index e298efe937..890e726b0f 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/AbstractSqmSelectQuery.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/tree/select/AbstractSqmSelectQuery.java @@ -205,14 +205,6 @@ public abstract class AbstractSqmSelectQuery return resultType; } - /** - * @deprecated Don't use this method. It has no effect. - */ - @Deprecated(forRemoval = true) - protected void setResultType(Class resultType) { - // No-op - } - @Override public SqmQuerySpec getQuerySpec() { return sqmQueryPart.getFirstQuerySpec(); @@ -228,11 +220,12 @@ public abstract class AbstractSqmSelectQuery } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public Set> getRoots() { return (Set) getQuerySpec().getRoots(); } + @SuppressWarnings("rawtypes") public List> getRootList() { return (List) getQuerySpec().getRootList(); } @@ -327,7 +320,7 @@ public abstract class AbstractSqmSelectQuery // Grouping @Override - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public List> getGroupList() { return (List) getQuerySpec().getGroupingExpressions(); } @@ -338,7 +331,7 @@ public abstract class AbstractSqmSelectQuery } @Override - @SuppressWarnings("unchecked") + @SuppressWarnings("rawtypes") public SqmSelectQuery groupBy(List> grouping) { getQuerySpec().setGroupingExpressions( (List) grouping ); return this; diff --git a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java index dfcd96c54d..ff025b4862 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java @@ -34,12 +34,6 @@ public interface JdbcSessionContext { */ Integer getFetchSizeOrNull(); - /** - * @deprecated this is never called, and luckily so, because it's not null-safe - */ - @Deprecated(since = "6.2", forRemoval = true) - int getFetchSize(); - /** * @see org.hibernate.cfg.AvailableSettings#CONNECTION_PROVIDER_DISABLES_AUTOCOMMIT */ diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlAstTranslatorFactory.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlAstTranslatorFactory.java index 8baa926fa2..457b15030c 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlAstTranslatorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/SqlAstTranslatorFactory.java @@ -8,15 +8,9 @@ package org.hibernate.sql.ast; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.sql.ast.tree.MutationStatement; -import org.hibernate.sql.ast.tree.delete.DeleteStatement; -import org.hibernate.sql.ast.tree.insert.InsertStatement; import org.hibernate.sql.ast.tree.select.SelectStatement; -import org.hibernate.sql.ast.tree.update.UpdateStatement; -import org.hibernate.sql.exec.spi.JdbcOperationQueryDelete; -import org.hibernate.sql.exec.spi.JdbcOperationQueryInsert; import org.hibernate.sql.exec.spi.JdbcOperationQueryMutation; import org.hibernate.sql.exec.spi.JdbcOperationQuerySelect; -import org.hibernate.sql.exec.spi.JdbcOperationQueryUpdate; import org.hibernate.sql.model.ast.TableMutation; import org.hibernate.sql.model.jdbc.JdbcMutationOperation; @@ -36,39 +30,6 @@ public interface SqlAstTranslatorFactory { */ SqlAstTranslator buildMutationTranslator(SessionFactoryImplementor sessionFactory, MutationStatement statement); - /** - * Builds a single-use delete translator - * - * @deprecated Use {@link #buildMutationTranslator(SessionFactoryImplementor, MutationStatement)} instead - */ - @Deprecated(forRemoval = true) - default SqlAstTranslator buildDeleteTranslator(SessionFactoryImplementor sessionFactory, DeleteStatement statement) { - //noinspection unchecked - return (SqlAstTranslator) buildMutationTranslator( sessionFactory, statement ); - } - - /** - * Builds a single-use insert-select translator - * - * @deprecated Use {@link #buildMutationTranslator(SessionFactoryImplementor, MutationStatement)} instead - */ - @Deprecated(forRemoval = true) - default SqlAstTranslator buildInsertTranslator(SessionFactoryImplementor sessionFactory, InsertStatement statement) { - //noinspection unchecked - return (SqlAstTranslator) buildMutationTranslator( sessionFactory, statement ); - } - - /** - * Builds a single-use update translator - * - * @deprecated Use {@link #buildMutationTranslator(SessionFactoryImplementor, MutationStatement)} instead - */ - @Deprecated(forRemoval = true) - default SqlAstTranslator buildUpdateTranslator(SessionFactoryImplementor sessionFactory, UpdateStatement statement) { - //noinspection unchecked - return (SqlAstTranslator) buildMutationTranslator( sessionFactory, statement ); - } - /** * Builds a single-use translator for dealing with model mutations */ diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java index 6da1287dd0..dc203088cf 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java @@ -6961,14 +6961,6 @@ public abstract class AbstractSqlAstTranslator implemen appendSql( getCastTypeName( castTarget, sessionFactory.getTypeConfiguration() ) ); } - /** - * @deprecated Use {@link #getSqlTypeName(SqlTypedMapping, TypeConfiguration)} instead - */ - @Deprecated(forRemoval = true) - public static String getSqlTypeName(SqlTypedMapping castTarget, SessionFactoryImplementor factory) { - return getSqlTypeName( castTarget, factory.getTypeConfiguration() ); - } - public static String getSqlTypeName(SqlTypedMapping castTarget, TypeConfiguration typeConfiguration) { if ( castTarget.getColumnDefinition() != null ) { return castTarget.getColumnDefinition(); @@ -6988,14 +6980,6 @@ public abstract class AbstractSqlAstTranslator implemen } } - /** - * @deprecated Use {@link #getCastTypeName(SqlTypedMapping, TypeConfiguration)} instead - */ - @Deprecated(forRemoval = true) - public static String getCastTypeName(SqlTypedMapping castTarget, SessionFactoryImplementor factory) { - return getCastTypeName( castTarget, factory.getTypeConfiguration() ); - } - public static String getCastTypeName(SqlTypedMapping castTarget, TypeConfiguration typeConfiguration) { if ( castTarget.getColumnDefinition() != null ) { return castTarget.getColumnDefinition(); @@ -8552,18 +8536,6 @@ public abstract class AbstractSqlAstTranslator implemen return true; } - /** - * Some databases require a bit of syntactic noise when - * there are no tables in the from clause. - * - * @return the SQL equivalent to Oracle's {@code from dual}. - * @deprecated Use {@link #getDual()} instead - */ - @Deprecated(forRemoval = true) - protected String getFromDual() { - return " from " + getDual() + " d_"; - } - /** * Returns a table expression that has one row. * diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/StandardSqlAstTranslatorFactory.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/StandardSqlAstTranslatorFactory.java index 8d141c0208..1e907d08dd 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/StandardSqlAstTranslatorFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/StandardSqlAstTranslatorFactory.java @@ -11,16 +11,10 @@ import org.hibernate.sql.ast.SqlAstTranslator; import org.hibernate.sql.ast.SqlAstTranslatorFactory; import org.hibernate.sql.ast.tree.MutationStatement; import org.hibernate.sql.ast.tree.Statement; -import org.hibernate.sql.ast.tree.delete.DeleteStatement; -import org.hibernate.sql.ast.tree.insert.InsertStatement; import org.hibernate.sql.ast.tree.select.SelectStatement; -import org.hibernate.sql.ast.tree.update.UpdateStatement; import org.hibernate.sql.exec.spi.JdbcOperation; -import org.hibernate.sql.exec.spi.JdbcOperationQueryDelete; -import org.hibernate.sql.exec.spi.JdbcOperationQueryInsert; import org.hibernate.sql.exec.spi.JdbcOperationQueryMutation; import org.hibernate.sql.exec.spi.JdbcOperationQuerySelect; -import org.hibernate.sql.exec.spi.JdbcOperationQueryUpdate; import org.hibernate.sql.model.ast.TableMutation; import org.hibernate.sql.model.jdbc.JdbcMutationOperation; @@ -41,21 +35,6 @@ public class StandardSqlAstTranslatorFactory implements SqlAstTranslatorFactory return buildTranslator( sessionFactory, statement ); } - @Override - public SqlAstTranslator buildDeleteTranslator(SessionFactoryImplementor sessionFactory, DeleteStatement statement) { - return buildTranslator( sessionFactory, statement ); - } - - @Override - public SqlAstTranslator buildInsertTranslator(SessionFactoryImplementor sessionFactory, InsertStatement statement) { - return buildTranslator( sessionFactory, statement ); - } - - @Override - public SqlAstTranslator buildUpdateTranslator(SessionFactoryImplementor sessionFactory, UpdateStatement statement) { - return buildTranslator( sessionFactory, statement ); - } - @Override public SqlAstTranslator buildModelMutationTranslator(TableMutation mutation, SessionFactoryImplementor sessionFactory) { return buildTranslator( sessionFactory, mutation ); diff --git a/hibernate-core/src/main/java/org/hibernate/sql/exec/spi/Callback.java b/hibernate-core/src/main/java/org/hibernate/sql/exec/spi/Callback.java index 8ff560eb08..5cee5795fd 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/exec/spi/Callback.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/exec/spi/Callback.java @@ -28,14 +28,5 @@ public interface Callback { */ void invokeAfterLoadActions(Object entity, EntityMappingType entityMappingType, SharedSessionContractImplementor session); - /** - * @deprecated Use the {@linkplain #invokeAfterLoadActions(Object, EntityMappingType, SharedSessionContractImplementor) updated signature} - */ - @SuppressWarnings("removal") - @Deprecated(since = "6", forRemoval = true) - default void invokeAfterLoadActions(SharedSessionContractImplementor session, Object entity, org.hibernate.persister.entity.Loadable persister) { - invokeAfterLoadActions( entity, persister, session ); - } - boolean hasAfterLoadActions(); } diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/Initializer.java b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/Initializer.java index 303b3ccf74..bc71d9089f 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/graph/Initializer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/graph/Initializer.java @@ -210,9 +210,9 @@ public interface Initializer { static boolean isPartOfKey(NavigablePath navigablePath, InitializerParent parent) { return parent != null && parent.isEmbeddableInitializer() && parent.isPartOfKey() - || navigablePath instanceof EntityIdentifierNavigablePath - || ForeignKeyDescriptor.PART_NAME.equals( navigablePath.getLocalName() ) - || ForeignKeyDescriptor.TARGET_PART_NAME.equals( navigablePath.getLocalName() ); + || navigablePath instanceof EntityIdentifierNavigablePath + || ForeignKeyDescriptor.PART_NAME.equals( navigablePath.getLocalName() ) + || ForeignKeyDescriptor.TARGET_PART_NAME.equals( navigablePath.getLocalName() ); } /** diff --git a/hibernate-core/src/main/java/org/hibernate/sql/results/internal/domain/CircularFetchImpl.java b/hibernate-core/src/main/java/org/hibernate/sql/results/internal/domain/CircularFetchImpl.java index 95645eb035..1564dece80 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/results/internal/domain/CircularFetchImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/results/internal/domain/CircularFetchImpl.java @@ -62,19 +62,6 @@ public class CircularFetchImpl extends AbstractNonJoinedEntityFetch implements B this.referencedNavigablePath = referencedNavigablePath; } - protected CircularFetchImpl(CircularFetchImpl original) { - super( - original.getNavigablePath(), - original.getFetchedMapping(), - original.getFetchParent(), - original.getKeyResult(), - original.getDiscriminatorFetch(), - original.isSelectByUniqueKey() - ); - this.timing = original.timing; - this.referencedNavigablePath = original.referencedNavigablePath; - } - @Override public NavigablePath getReferencedPath() { return referencedNavigablePath; diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/ColumnDefinitions.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/ColumnDefinitions.java index dc8db23f59..13e1084652 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/ColumnDefinitions.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/ColumnDefinitions.java @@ -6,6 +6,7 @@ */ package org.hibernate.tool.schema.internal; +import org.hibernate.HibernateException; import org.hibernate.boot.Metadata; import org.hibernate.boot.model.relational.SqlStringGenerationContext; import org.hibernate.dialect.Dialect; @@ -13,12 +14,16 @@ import org.hibernate.engine.jdbc.Size; import org.hibernate.internal.util.StringHelper; import org.hibernate.mapping.CheckConstraint; import org.hibernate.mapping.Column; -import org.hibernate.mapping.Constraint; import org.hibernate.mapping.Table; import org.hibernate.mapping.UniqueKey; import org.hibernate.tool.schema.extract.spi.ColumnInformation; import org.hibernate.type.descriptor.jdbc.JdbcType; +import java.math.BigInteger; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.Comparator; import java.util.List; import java.util.Locale; @@ -133,7 +138,7 @@ class ColumnDefinitions { final String keyName = uniqueKeyName == null // fallback in case the ImplicitNamingStrategy name was not assigned // (we don't have access to the ImplicitNamingStrategy here) - ? Constraint.generateName( "UK_", table, column ) + ? generateName( "UK_", table, column ) : uniqueKeyName; final UniqueKey uniqueKey = table.getOrCreateUniqueKey( keyName ); uniqueKey.addColumn( column ); @@ -266,4 +271,62 @@ class ColumnDefinitions { return i>0 ? typeExpression.substring(0,i).trim() : typeExpression; } } + + /** + * If a constraint is not explicitly named, this is called to generate + * a unique hash using the table and column names. + * Static so the name can be generated prior to creating the Constraint. + * They're cached, keyed by name, in multiple locations. + * + * @return String The generated name + * + * @deprecated This method does not respect the + * {@link org.hibernate.boot.model.naming.ImplicitNamingStrategy} + */ + @Deprecated(since = "6.5", forRemoval = true) + private static String generateName(String prefix, Table table, Column... columns) { + // Use a concatenation that guarantees uniqueness, even if identical names + // exist between all table and column identifiers. + final StringBuilder sb = new StringBuilder( "table`" + table.getName() + "`" ); + // Ensure a consistent ordering of columns, regardless of the order + // they were bound. + // Clone the list, as sometimes a set of order-dependent Column + // bindings are given. + final Column[] alphabeticalColumns = columns.clone(); + Arrays.sort( alphabeticalColumns, Comparator.comparing( Column::getName ) ); + for ( Column column : alphabeticalColumns ) { + final String columnName = column == null ? "" : column.getName(); + sb.append( "column`" ).append( columnName ).append( "`" ); + } + return prefix + hashedName( sb.toString() ); + } + + /** + * Hash a constraint name using MD5. Convert the MD5 digest to base 35 + * (full alphanumeric), guaranteeing + * that the length of the name will always be smaller than the 30 + * character identifier restriction enforced by a few dialects. + * + * @param name The name to be hashed. + * @return String The hashed name. + * + * @deprecated Only used from deprecated methods + */ + @Deprecated(since = "6.5", forRemoval = true) + private static String hashedName(String name) { + try { + final MessageDigest md = MessageDigest.getInstance( "MD5" ); + md.reset(); + md.update( name.getBytes() ); + final byte[] digest = md.digest(); + final BigInteger bigInt = new BigInteger( 1, digest ); + // By converting to base 35 (full alphanumeric), we guarantee + // that the length of the name will always be smaller than the 30 + // character identifier restriction enforced by a few dialects. + return bigInt.toString( 35 ); + } + catch ( NoSuchAlgorithmException e ) { + throw new HibernateException( "Unable to generate a hashed Constraint name", e ); + } + } } diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java index 2f0dbd9088..e1b41241e3 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/internal/StandardTableExporter.java @@ -25,8 +25,10 @@ import org.hibernate.mapping.BasicValue; import org.hibernate.mapping.CheckConstraint; import org.hibernate.mapping.Column; import org.hibernate.mapping.Component; +import org.hibernate.mapping.PrimaryKey; import org.hibernate.mapping.Property; import org.hibernate.mapping.Table; +import org.hibernate.mapping.UniqueKey; import org.hibernate.mapping.Value; import org.hibernate.sql.Template; import org.hibernate.tool.schema.spi.Exporter; @@ -95,7 +97,7 @@ public class StandardTableExporter implements Exporter { } } if ( table.hasPrimaryKey() ) { - createTable.append( ", " ).append( table.getPrimaryKey().sqlConstraintString( dialect ) ); + createTable.append( ", " ).append( primaryKeyString( table.getPrimaryKey() ) ); } createTable.append( dialect.getUniqueDelegate().getTableCreationUniqueConstraintsFragment( table, context ) ); @@ -333,6 +335,27 @@ public class StandardTableExporter implements Exporter
{ } + protected String primaryKeyString(PrimaryKey key) { + final StringBuilder constraint = new StringBuilder(); + final UniqueKey orderingUniqueKey = key.getOrderingUniqueKey(); + if ( orderingUniqueKey != null && orderingUniqueKey.isNameExplicit() ) { + constraint.append( "constraint " ) + .append( orderingUniqueKey.getName() ).append( ' ' ); + } + constraint.append( "primary key (" ); + boolean first = true; + for ( Column column : key.getColumns() ) { + if ( first ) { + first = false; + } + else { + constraint.append(", "); + } + constraint.append( column.getQuotedName( dialect ) ); + } + return constraint.append(')').toString(); + } + @Override public String[] getSqlDropStrings(Table table, Metadata metadata, SqlStringGenerationContext context) { final StringBuilder dropTable = new StringBuilder(); diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/SchemaManagementToolCoordinator.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/SchemaManagementToolCoordinator.java index b2920cbd28..2365adf23d 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/SchemaManagementToolCoordinator.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/spi/SchemaManagementToolCoordinator.java @@ -190,17 +190,6 @@ public class SchemaManagementToolCoordinator { }; } - /** - * @deprecated Use {@link #buildExecutionOptions(Map, ExceptionHandler)} instead. - */ - @Deprecated(forRemoval = true) - public static ExecutionOptions buildExecutionOptions( - final Map configurationValues, - final SchemaFilter schemaFilter, - final ExceptionHandler exceptionHandler) { - return buildExecutionOptions( configurationValues, exceptionHandler ); - } - private static void performDatabaseAction( final Action action, Metadata metadata, diff --git a/hibernate-core/src/main/java/org/hibernate/type/AbstractType.java b/hibernate-core/src/main/java/org/hibernate/type/AbstractType.java index d67d3026ec..361bdf3b0a 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/AbstractType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/AbstractType.java @@ -11,7 +11,6 @@ import java.util.Map; import java.util.Objects; import org.hibernate.HibernateException; -import org.hibernate.engine.jdbc.Size; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor; @@ -22,12 +21,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor; */ public abstract class AbstractType implements Type { - @Deprecated(forRemoval = true) - protected static final Size LEGACY_DICTATED_SIZE = new Size(); - - @Deprecated(forRemoval = true) - protected static final Size LEGACY_DEFAULT_SIZE = new Size( 19, 2, 255L ); // to match legacy behavior - @Override public boolean isAssociationType() { return false; diff --git a/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java b/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java index b970319165..093531222e 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/ComponentType.java @@ -19,7 +19,6 @@ import org.hibernate.HibernateException; import org.hibernate.MappingException; import org.hibernate.PropertyNotFoundException; import org.hibernate.Remove; -import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer; import org.hibernate.engine.spi.CascadeStyle; import org.hibernate.engine.spi.CascadeStyles; @@ -73,11 +72,6 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen private EmbeddableValuedModelPart mappingModelPart; - @Deprecated(forRemoval = true) - public ComponentType(Component component, int[] originalPropertyOrder, MetadataBuildingContext context) { - this( component, originalPropertyOrder ); - } - public ComponentType(Component component, int[] originalPropertyOrder) { this( component, originalPropertyOrder, component.getComponentClassName() != null diff --git a/hibernate-core/src/main/java/org/hibernate/type/EmbeddedComponentType.java b/hibernate-core/src/main/java/org/hibernate/type/EmbeddedComponentType.java index 1923ae4129..c8942b64a7 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/EmbeddedComponentType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/EmbeddedComponentType.java @@ -8,7 +8,6 @@ package org.hibernate.type; import java.lang.reflect.Method; -import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.mapping.Component; import org.hibernate.metamodel.mapping.AttributeMapping; import org.hibernate.metamodel.mapping.EmbeddableMappingType; @@ -19,11 +18,6 @@ import org.hibernate.property.access.spi.Getter; */ public class EmbeddedComponentType extends ComponentType { - @Deprecated(forRemoval = true) - public EmbeddedComponentType(Component component, int[] originalPropertyOrder, MetadataBuildingContext buildingContext) { - super( component, originalPropertyOrder, buildingContext ); - } - public EmbeddedComponentType(Component component, int[] originalPropertyOrder) { super( component, originalPropertyOrder ); } diff --git a/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypes.java b/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypes.java index 9bccc16c35..7e0160a3c0 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypes.java +++ b/hibernate-core/src/main/java/org/hibernate/type/StandardBasicTypes.java @@ -572,14 +572,6 @@ public final class StandardBasicTypes { SqlTypes.VARBINARY ); - /** - * The standard Hibernate type for mapping {@link Byte Byte[]} to JDBC {@link org.hibernate.type.SqlTypes#VARBINARY VARBINARY}. - * - * @deprecated use {@link #BINARY_WRAPPER} instead - */ - @Deprecated(forRemoval = true) - public static final BasicTypeReference WRAPPER_BINARY = BINARY_WRAPPER; - /** * The standard Hibernate type for mapping {@code byte[]} to JDBC {@link org.hibernate.type.SqlTypes#LONGVARBINARY LONGVARBINARY}. * diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/DateTimeUtils.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/DateTimeUtils.java index 42487e0c4a..369ac57233 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/DateTimeUtils.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/DateTimeUtils.java @@ -393,25 +393,6 @@ public final class DateTimeUtils { } } - /** - * Calendar has no microseconds. - * - * @deprecated use {@link #appendAsTimestampWithMillis(SqlAppender, Calendar, TimeZone)} instead - */ - @Deprecated(forRemoval = true) - public static void appendAsTimestampWithMicros(SqlAppender appender, Calendar calendar, TimeZone jdbcTimeZone) { - // it is possible to use micro sec resolution with java.util.Date - final SimpleDateFormat simpleDateFormat = TIMESTAMP_WITH_MILLIS_FORMAT.get(); - final TimeZone originalTimeZone = simpleDateFormat.getTimeZone(); - try { - simpleDateFormat.setTimeZone( jdbcTimeZone ); - appender.appendSql( simpleDateFormat.format( calendar.getTime() ) ); - } - finally { - simpleDateFormat.setTimeZone( originalTimeZone ); - } - } - public static void appendAsDate(SqlAppender appender, java.util.Calendar calendar) { final SimpleDateFormat simpleDateFormat = LOCAL_DATE_FORMAT.get(); final TimeZone originalTimeZone = simpleDateFormat.getTimeZone(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/AlternativeNamingStrategy.java b/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/AlternativeNamingStrategy.java deleted file mode 100644 index f2bd34277d..0000000000 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/annotations/AlternativeNamingStrategy.java +++ /dev/null @@ -1,78 +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 . - */ - -//$Id$ -package org.hibernate.orm.test.annotations; -import org.hibernate.cfg.PersistenceStandardNamingStrategy; -import org.hibernate.cfg.NamingStrategy; -import org.hibernate.internal.util.StringHelper; - -/** - * @author Emmanuel Bernard - */ -public class AlternativeNamingStrategy extends PersistenceStandardNamingStrategy { - public static NamingStrategy INSTANCE = new AlternativeNamingStrategy(); - - public String classToTableName(String className) { - return tableName( StringHelper.unqualify( className ) ); - } - - public String propertyToColumnName(String propertyName) { - return columnName( StringHelper.unqualify( propertyName ) ); - } - - public String tableName(String tableName) { - return "table_" + tableName; - } - - public String columnName(String columnName) { - return "f_" + columnName; - } - - public String propertyToTableName(String className, String propertyName) { - return tableName( StringHelper.unqualify( className ) + "_" + StringHelper.unqualify( propertyName ) ); - } - - public String logicalColumnName(String columnName, String propertyName) { - return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName; - } - - public String collectionTableName( - String ownerEntity, String ownerEntityTable, String associatedEntity, String associatedEntityTable, - String propertyName - ) { - return tableName( - new StringBuilder( ownerEntityTable ).append( "_" ) - .append( - associatedEntityTable != null ? - associatedEntityTable : - StringHelper.unqualify( propertyName ) - ).toString() - ); - } - - public String logicalCollectionTablelName( - String tableName, - String ownerEntityTable, String associatedEntityTable, String propertyName - ) { - if ( tableName != null ) { - return tableName; - } - else { - return new StringBuilder( ownerEntityTable ).append( "_" ) - .append( - associatedEntityTable != null ? - associatedEntityTable : - StringHelper.unqualify( propertyName ) - ).toString(); - } - } - - public String logicalCollectionColumnName(String columnName, String propertyName, String referencedColumn) { - return StringHelper.isNotEmpty( columnName ) ? columnName : propertyName + "_" + referencedColumn; - } -} diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java index bdcf83ace0..d2d9926cc8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bytecode/enhancement/lazy/proxy/inlinedirtychecking/LoadingLazyCollectionAfterQueryExecutionWithFlushModeAlwaysTest.java @@ -14,6 +14,7 @@ import org.hibernate.bytecode.internal.BytecodeProviderInitiator; import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; +import org.hibernate.jpa.HibernateHints; import org.hibernate.testing.bytecode.enhancement.CustomEnhancementContext; import org.hibernate.testing.bytecode.enhancement.extension.BytecodeEnhanced; import org.hibernate.testing.orm.junit.DomainModel; @@ -42,7 +43,7 @@ import static org.junit.jupiter.api.Assumptions.assumeFalse; ) @ServiceRegistry( settings = { - @Setting( name = AvailableSettings.FLUSH_MODE, value = "ALWAYS" ), + @Setting( name = HibernateHints.HINT_FLUSH_MODE, value = "ALWAYS" ), } ) @SessionFactory diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java index 66d67a2e92..b06110b49c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/hql/BulkManipulationTest.java @@ -668,10 +668,6 @@ public class BulkManipulationTest extends BaseCoreFunctionalTestCase { } @Test - @RequiresDialectFeature( - value = DialectChecks.SupportsParametersInInsertSelectCheck.class, - comment = "dialect does not support parameter in INSERT ... SELECT" - ) public void testInsertWithGeneratedTimestampVersion() { // Make sure the env supports bulk inserts with generated ids... Assumptions.assumeTrue( supportsBulkInsertIdGeneration( TimestampVersioned.class ), "bulk id generation not supported" ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/internal/util/FlushModeConfigTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/internal/util/FlushModeConfigTest.java index 42f8d7b5d6..5badc03a8f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/internal/util/FlushModeConfigTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/internal/util/FlushModeConfigTest.java @@ -12,8 +12,8 @@ import org.hibernate.SessionFactory; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; -import org.hibernate.cfg.AvailableSettings; +import org.hibernate.jpa.HibernateHints; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.BaseUnitTest; import org.hibernate.testing.util.ServiceRegistryUtil; @@ -32,7 +32,7 @@ public class FlushModeConfigTest { @EnumSource( FlushMode.class ) public void testFlushModeSettingTakingEffect(FlushMode flushMode) { final StandardServiceRegistry serviceRegistry = ServiceRegistryUtil.serviceRegistryBuilder() - .applySetting( AvailableSettings.FLUSH_MODE, flushMode.name() ) + .applySetting(HibernateHints.HINT_FLUSH_MODE, flushMode.name() ) .build(); try ( final SessionFactory sessionFactory = new MetadataSources(serviceRegistry).buildMetadata().buildSessionFactory() ) { try ( final Session session = sessionFactory.openSession() ) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/EntityManagerTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/EntityManagerTest.java index 16409f3e30..62ecf25010 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/EntityManagerTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/EntityManagerTest.java @@ -19,8 +19,8 @@ import org.hibernate.FlushMode; import org.hibernate.HibernateException; import org.hibernate.Session; import org.hibernate.SessionFactory; -import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.Environment; +import org.hibernate.jpa.HibernateHints; import org.hibernate.stat.Statistics; import org.hibernate.testing.TestForIssue; @@ -333,7 +333,7 @@ public class EntityManagerTest extends BaseEntityManagerFunctionalTestCase { // success } - assertTrue( properties.containsKey( org.hibernate.cfg.AvailableSettings.FLUSH_MODE ) ); + assertTrue( properties.containsKey(HibernateHints.HINT_FLUSH_MODE) ); } @Test @@ -346,7 +346,7 @@ public class EntityManagerTest extends BaseEntityManagerFunctionalTestCase { em.getTransaction().commit(); em.clear(); - assertEquals( em.getProperties().get( org.hibernate.cfg.AvailableSettings.FLUSH_MODE ), "AUTO" ); + assertEquals( em.getProperties().get(HibernateHints.HINT_FLUSH_MODE), "AUTO" ); assertNotNull( "With default settings the entity should be persisted on commit.", em.find( Wallet.class, wallet.getSerial() ) @@ -373,7 +373,7 @@ public class EntityManagerTest extends BaseEntityManagerFunctionalTestCase { "With a flush mode of manual the entity should not have been persisted.", em.find( Wallet.class, wallet.getSerial() ) ); - assertEquals( "MANUAL", em.getProperties().get( AvailableSettings.FLUSH_MODE ) ); + assertEquals( "MANUAL", em.getProperties().get(HibernateHints.HINT_FLUSH_MODE) ); em.close(); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java index 072f25830b..7b2e0fc85c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/emops/FlushModeTest.java @@ -6,8 +6,7 @@ */ package org.hibernate.orm.test.jpa.emops; -import org.hibernate.cfg.AvailableSettings; - +import org.hibernate.jpa.HibernateHints; import org.hibernate.testing.orm.junit.EntityManagerFactoryScope; import org.hibernate.testing.orm.junit.Jpa; import org.hibernate.testing.orm.junit.Setting; @@ -23,7 +22,7 @@ import org.junit.jupiter.api.Test; annotatedClasses = { Dress.class }, - integrationSettings = { @Setting(name = AvailableSettings.FLUSH_MODE, value = "manual") } + integrationSettings = { @Setting(name = HibernateHints.HINT_FLUSH_MODE, value = "manual") } ) public class FlushModeTest { diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java index 95e4d2fd07..22fecf2b8b 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AuditMetadataGenerator.java @@ -152,7 +152,7 @@ public final class AuditMetadataGenerator extends AbstractMetadataGenerator { org.hibernate.mapping.Join join = joins.next(); // Checking if all of the join properties are audited - if ( !checkPropertiesAudited( join.getPropertyIterator(), auditingData ) ) { + if ( !checkPropertiesAudited( join.getProperties().iterator(), auditingData ) ) { continue; } @@ -205,7 +205,7 @@ public final class AuditMetadataGenerator extends AbstractMetadataGenerator { if ( entityJoin != null ) { addProperties( entityJoin, - join.getPropertyIterator(), + join.getProperties().iterator(), currentMapper, auditingData, entityName, diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java index 5e55996605..7c148ff4b3 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/DialectChecks.java @@ -97,12 +97,6 @@ abstract public class DialectChecks { } } - public static class SupportsParametersInInsertSelectCheck implements DialectCheck { - public boolean isMatch(Dialect dialect) { - return dialect.supportsParametersInInsertSelect(); - } - } - public static class HasSelfReferentialForeignKeyBugCheck implements DialectCheck { public boolean isMatch(Dialect dialect) { return dialect.hasSelfReferentialForeignKeyBug(); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java index d775d6cbc7..c7ce1cba97 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/orm/junit/DialectFeatureChecks.java @@ -138,12 +138,6 @@ abstract public class DialectFeatureChecks { } } - public static class SupportsParametersInInsertSelectCheck implements DialectFeatureCheck { - public boolean apply(Dialect dialect) { - return dialect.supportsParametersInInsertSelect(); - } - } - public static class HasSelfReferentialForeignKeyBugCheck implements DialectFeatureCheck { public boolean apply(Dialect dialect) { return dialect.hasSelfReferentialForeignKeyBug();