diff --git a/hibernate-core/src/main/java/org/hibernate/EntityMode.java b/hibernate-core/src/main/java/org/hibernate/EntityMode.java index 522a333e34..1f07ca88d4 100644 --- a/hibernate-core/src/main/java/org/hibernate/EntityMode.java +++ b/hibernate-core/src/main/java/org/hibernate/EntityMode.java @@ -8,16 +8,11 @@ package org.hibernate; import java.util.Locale; -import static org.hibernate.cfg.AvailableSettings.DEFAULT_ENTITY_MODE; -import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER; - /** * Defines the representation modes available for entities. * - * @deprecated To be removed in 6.0 in favor of `ManagedTypeRepresentationStrategy` - * and `RepresentationMode` + * @author Steve Ebersole */ -@Deprecated public enum EntityMode { /** * The {@code pojo} entity mode describes an entity model made up of entity classes (loosely) following @@ -63,23 +58,4 @@ public enum EntityMode { return valueOf( entityMode.toUpperCase( Locale.ENGLISH ) ); } - public static EntityMode fromSetting(Object setting) { - if ( setting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( DEFAULT_ENTITY_MODE ); - } - - if ( setting == null || setting == POJO ) { - return POJO; - } - - if ( setting instanceof EntityMode ) { - return ( (EntityMode) setting ); - } - - if ( setting instanceof String ) { - return parse( (String) setting ); - } - - return POJO; - } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java index 1f4875e9bb..704437008f 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java @@ -130,7 +130,6 @@ import static org.hibernate.cfg.AvailableSettings.WRAP_RESULT_SETS; import static org.hibernate.cfg.AvailableSettings.DISCARD_PC_ON_CLOSE; import static org.hibernate.engine.config.spi.StandardConverters.BOOLEAN; import static org.hibernate.internal.CoreLogging.messageLogger; -import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER; /** * In-flight state of {@link org.hibernate.boot.spi.SessionFactoryOptions} @@ -331,11 +330,10 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { this.entityNotFoundDelegate = StandardEntityNotFoundDelegate.INSTANCE; this.identifierRollbackEnabled = cfgService.getSetting( USE_IDENTIFIER_ROLLBACK, BOOLEAN, false ); + this.defaultEntityMode = EntityMode.parse( (String) configurationSettings.get( DEFAULT_ENTITY_MODE ) ); this.checkNullability = cfgService.getSetting( CHECK_NULLABILITY, BOOLEAN, true ); this.initializeLazyStateOutsideTransactions = cfgService.getSetting( ENABLE_LAZY_LOAD_NO_TRANS, BOOLEAN, false ); - this.defaultEntityMode = EntityMode.fromSetting( configurationSettings.get( DEFAULT_ENTITY_MODE ) ); - this.multiTenancyStrategy = MultiTenancyStrategy.determineMultiTenancyStrategy( configurationSettings ); this.currentTenantIdentifierResolver = strategySelector.resolveStrategy( CurrentTenantIdentifierResolver.class, @@ -477,7 +475,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { null ); if ( oldSetting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( + DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( org.hibernate.jpa.AvailableSettings.DISCARD_PC_ON_CLOSE, DISCARD_PC_ON_CLOSE ); @@ -564,7 +562,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { () -> { final Object oldSetting = configurationSettings.get( org.hibernate.jpa.AvailableSettings.INTERCEPTOR ); if ( oldSetting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( + DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( org.hibernate.jpa.AvailableSettings.INTERCEPTOR, INTERCEPTOR ); @@ -585,7 +583,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { () -> { final Object oldSetting = configurationSettings.get( org.hibernate.jpa.AvailableSettings.SESSION_INTERCEPTOR ); if ( oldSetting != null ) { - DEPRECATION_LOGGER.deprecatedSetting( + DeprecationLogger.DEPRECATION_LOGGER.deprecatedSetting( org.hibernate.jpa.AvailableSettings.SESSION_INTERCEPTOR, SESSION_SCOPED_INTERCEPTOR ); @@ -661,7 +659,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { ConnectionReleaseMode specifiedReleaseMode, Map configurationSettings, TransactionCoordinatorBuilder transactionCoordinatorBuilder) { - DEPRECATION_LOGGER.logUseOfDeprecatedConnectionHandlingSettings(); + DeprecationLogger.DEPRECATION_LOGGER.logUseOfDeprecatedConnectionHandlingSettings(); final ConnectionAcquisitionMode effectiveAcquisitionMode = specifiedAcquisitionMode == null ? ConnectionAcquisitionMode.AS_NEEDED diff --git a/hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/internal/EntityModeConverter.java b/hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/internal/EntityModeConverter.java index 6c5aa1ad1b..d9548064fa 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/internal/EntityModeConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/jaxb/hbm/internal/EntityModeConverter.java @@ -7,31 +7,16 @@ package org.hibernate.boot.jaxb.hbm.internal; import org.hibernate.EntityMode; -import org.hibernate.internal.log.DeprecationLogger; -import org.hibernate.internal.util.StringHelper; /** - * @deprecated for removal in 6.0 + * @author Steve Ebersole */ -@Deprecated public class EntityModeConverter { public static EntityMode fromXml(String name) { - final EntityMode entityMode = EntityMode.parse( name ); - if ( StringHelper.isNotEmpty( name ) ) { - DeprecationLogger.DEPRECATION_LOGGER.info( - "XML mapping specified an entity-mode - `%s`. Starting in 6.0 this is simply inferred from the entity/composite mapping" - ); - } - return entityMode; + return EntityMode.parse( name ); } public static String toXml(EntityMode entityMode) { - if ( entityMode == null ) { - return null; - } - DeprecationLogger.DEPRECATION_LOGGER.info( - "XML mapping specified an entity-mode - `%s`. Starting in 6.0 this is simply inferred from the entity/composite mapping" - ); - return entityMode.getExternalName(); + return ( null == entityMode ) ? null : entityMode.getExternalName(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/AbstractEntitySourceImpl.java b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/AbstractEntitySourceImpl.java index 230856c212..cfb2826243 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/AbstractEntitySourceImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/source/internal/hbm/AbstractEntitySourceImpl.java @@ -324,22 +324,10 @@ public abstract class AbstractEntitySourceImpl return jaxbEntityMapping.isSelectBeforeUpdate(); } - /** - * @deprecated to be removed in 6.0. Starting in 6.0 the mode is inferred - * from the entity-type mapping - */ - @Deprecated protected EntityMode determineEntityMode() { return StringHelper.isNotEmpty( entityNamingSource.getClassName() ) ? EntityMode.POJO : EntityMode.MAP; } - /** - * @deprecated to be removed in 6.0. Starting in 6.0 the mode is inferred - * from the entity-type mapping - * - * See `ManagedTypeRepresentationStrategy` and `RepresentationMode` in 6.0 - */ - @Deprecated @Override public Map getTuplizerClassMap() { return tuplizerClassMap; 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 59d79cb715..f4da85d681 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -1409,10 +1409,7 @@ public interface AvailableSettings extends org.hibernate.jpa.AvailableSettings { /** * The EntityMode in which set the Session opened from the SessionFactory. - * - * @deprecated An entity-type has one "mode" relative to any SessionFactory. */ - @Deprecated String DEFAULT_ENTITY_MODE = "hibernate.default_entity_mode"; /** diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java index 9f709d59a3..9ecfe081bf 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java @@ -297,10 +297,4 @@ public interface DeprecationLogger extends BasicLogger { ) void deprecatedJmxBeanRegistration(String name); - @LogMessage(level = WARN) - @Message( - id = 90000031, - value = "Encountered deprecated setting [%s] which is planned for removal" - ) - void deprecatedSetting(String setting); } diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java index 16ec664d32..9c0120b185 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/Tuplizer.java @@ -31,12 +31,8 @@ import org.hibernate.property.access.spi.Getter; * @see org.hibernate.tuple.entity.EntityTuplizer * @see org.hibernate.tuple.component.ComponentTuplizer * - * @deprecated for removal in 6.0. See instead `ManagedTypeRepresentationStrategy` - * and `RepresentationMode` in 6.0 - * * @author Steve Ebersole */ -@Deprecated public interface Tuplizer { /** * Extract the current values contained on the given entity. diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java index 75eaa2572e..916e02b6d5 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/component/ComponentTuplizer.java @@ -20,11 +20,7 @@ import org.hibernate.tuple.Tuplizer; * * @author Gavin King * @author Steve Ebersole - * - * @deprecated for removal in 6.0. See instead `ManagedTypeRepresentationStrategy` - * and `RepresentationMode` in 6.0 */ -@Deprecated public interface ComponentTuplizer extends Tuplizer, Serializable { /** * Retrieve the current value of the parent property. diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java index 2f7e932b4e..68b8b9d22f 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityTuplizer.java @@ -28,11 +28,7 @@ import org.hibernate.tuple.Tuplizer; * * @author Gavin King * @author Steve Ebersole - * - * @deprecated for removal in 6.0. See instead `ManagedTypeRepresentationStrategy` - * and `RepresentationMode` in 6.0 */ -@Deprecated public interface EntityTuplizer extends Tuplizer { /** * Return the entity-mode handled by this tuplizer instance.