Revert deprecations on main (#4412)

* Revert "HHH-14857 - Deprecations in preparation for 6"

This reverts commit 91e29358be.

* Revert "HHH-14857 - Deprecations in preparation for 6"

This reverts commit e4b56b9271.
This commit is contained in:
Jan Schatteman 2021-12-02 22:06:01 +01:00 committed by GitHub
parent f604e8fa33
commit 69cd716e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 9 additions and 83 deletions

View File

@ -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;
}
}

View File

@ -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

View File

@ -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();
}
}

View File

@ -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<EntityMode, String> getTuplizerClassMap() {
return tuplizerClassMap;

View File

@ -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";
/**

View File

@ -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);
}

View File

@ -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.

View File

@ -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.

View File

@ -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.