Clean up various legacy "read path" contracts
- clean-up unused Type methods * Type#nullSafeGet * Type#hydrate * Type#resolve * Type#getSemiResolvedType * Type#semiResolve * related - start removing usage of Tuplizer - start removing usage of legacy Tuplizer-based Instantiator - Drop `EntityMode` completely
This commit is contained in:
parent
d2530df5ac
commit
c34ea34f6b
|
@ -435,9 +435,6 @@ This is an experimental feature that has known issues. It should not be used in
|
|||
`*hibernate.entity_dirtiness_strategy*` (e.g. fully-qualified class name or an actual `CustomEntityDirtinessStrategy` instance)::
|
||||
Setting to identify an `org.hibernate.CustomEntityDirtinessStrategy` to use.
|
||||
|
||||
`*hibernate.default_entity_mode*` (e.g. `pojo` (default value) or `dynamic-map`)::
|
||||
Default `EntityMode` for entity representation for all sessions opened from this `SessionFactory`, defaults to `pojo`.
|
||||
|
||||
`*hibernate.type.json_format_mapper*` (e.g. A fully-qualified class name, an instance, or a `Class` object reference)::
|
||||
Names a https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/type/FormatMapper.html[`FormatMapper`] implementation to be applied to the `SessionFactory` for JSON serialization and deserialization.
|
||||
+
|
||||
|
|
|
@ -8,6 +8,8 @@ package org.hibernate;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
/**
|
||||
* An interceptor that does nothing. May be used as a base class for application-defined custom interceptors.
|
||||
*
|
||||
|
@ -23,4 +25,9 @@ public class EmptyInterceptor implements Interceptor, Serializable {
|
|||
public static final Interceptor INSTANCE = new EmptyInterceptor();
|
||||
|
||||
protected EmptyInterceptor() {}
|
||||
|
||||
@Override
|
||||
public Object instantiate(String entityName, RepresentationMode representationMode, Object id) throws CallbackException {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,66 +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;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
/**
|
||||
* Defines the representation modes available for entities.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated See {@link RepresentationMode}
|
||||
*/
|
||||
@Deprecated
|
||||
public enum EntityMode {
|
||||
/**
|
||||
* The {@code pojo} entity mode describes an entity model made up of entity classes (loosely) following
|
||||
* the java bean convention.
|
||||
*/
|
||||
POJO( "pojo" ),
|
||||
|
||||
/**
|
||||
* The {@code dynamic-map} entity mode describes an entity model defined using {@link java.util.Map} references.
|
||||
*/
|
||||
MAP( "dynamic-map" );
|
||||
|
||||
private final String externalName;
|
||||
|
||||
private EntityMode(String externalName) {
|
||||
this.externalName = externalName;
|
||||
}
|
||||
|
||||
public String getExternalName() {
|
||||
return externalName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return externalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Legacy-style entity-mode name parsing. <b>Case insensitive</b>
|
||||
*
|
||||
* @param entityMode The entity mode name to evaluate
|
||||
*
|
||||
* @return The appropriate entity mode; {@code null} for incoming {@code entityMode} param is treated by returning
|
||||
* {@link #POJO}.
|
||||
*/
|
||||
public static EntityMode parse(String entityMode) {
|
||||
if ( entityMode == null ) {
|
||||
return POJO;
|
||||
}
|
||||
if ( MAP.externalName.equalsIgnoreCase( entityMode ) ) {
|
||||
return MAP;
|
||||
}
|
||||
return valueOf( entityMode.toUpperCase( Locale.ENGLISH ) );
|
||||
}
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ package org.hibernate;
|
|||
import java.io.Serializable;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -412,26 +413,6 @@ public interface Interceptor {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the entity class. Return <tt>null</tt> to indicate that Hibernate should use
|
||||
* the default constructor of the class. The identifier property of the returned instance
|
||||
* should be initialized with the given identifier.
|
||||
*
|
||||
* @param entityName the name of the entity
|
||||
* @param entityMode The type of entity instance to be returned.
|
||||
* @param id the identifier of the new instance
|
||||
*
|
||||
* @return an instance of the class, or <tt>null</tt> to choose default behaviour
|
||||
*
|
||||
* @throws CallbackException Thrown if the interceptor encounters any problems handling the callback.
|
||||
*
|
||||
* @deprecated Use {@link #instantiate(String, EntityRepresentationStrategy, Object)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
default Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate the entity. Return <tt>null</tt> to indicate that Hibernate should use
|
||||
* the default constructor of the class. The identifier property of the returned instance
|
||||
|
@ -441,12 +422,14 @@ public interface Interceptor {
|
|||
String entityName,
|
||||
EntityRepresentationStrategy representationStrategy,
|
||||
Object id) throws CallbackException {
|
||||
if (id instanceof Serializable) {
|
||||
return instantiate( entityName, representationStrategy.getMode().getLegacyEntityMode(), (Serializable) id );
|
||||
}
|
||||
return null;
|
||||
return instantiate( entityName, representationStrategy.getMode(), id );
|
||||
}
|
||||
|
||||
Object instantiate(
|
||||
String entityName,
|
||||
RepresentationMode representationMode,
|
||||
Object id) throws CallbackException;
|
||||
|
||||
/**
|
||||
* Get the entity name for a persistent or transient instance.
|
||||
*
|
||||
|
|
|
@ -11,18 +11,18 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.SessionFactoryObserver;
|
||||
import org.hibernate.cache.spi.TimestampsCacheFactory;
|
||||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||
import org.hibernate.jpa.spi.JpaCompliance;
|
||||
import org.hibernate.loader.BatchFetchStyle;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
|
||||
import org.hibernate.resource.jdbc.spi.StatementInspector;
|
||||
|
@ -219,20 +219,6 @@ public interface SessionFactoryBuilder {
|
|||
*/
|
||||
SessionFactoryBuilder applyIdentifierRollbackSupport(boolean enabled);
|
||||
|
||||
/**
|
||||
* Applies the given entity mode as the default for the SessionFactory.
|
||||
*
|
||||
* @param entityMode The default entity mode to use.
|
||||
*
|
||||
* @return {@code this}, for method chaining
|
||||
*
|
||||
* @see org.hibernate.cfg.AvailableSettings#DEFAULT_ENTITY_MODE
|
||||
*
|
||||
* @deprecated Different entity modes per entity is soon to be removed as a feature.
|
||||
*/
|
||||
@Deprecated
|
||||
SessionFactoryBuilder applyDefaultEntityMode(EntityMode entityMode);
|
||||
|
||||
/**
|
||||
* Should attributes using columns marked as not-null be checked (by Hibernate) for nullness?
|
||||
*
|
||||
|
@ -275,7 +261,7 @@ public interface SessionFactoryBuilder {
|
|||
* @return {@code this}, for method chaining
|
||||
*/
|
||||
SessionFactoryBuilder applyEntityTuplizer(
|
||||
EntityMode entityMode,
|
||||
RepresentationMode entityMode,
|
||||
Class<? extends EntityTuplizer> tuplizerClass);
|
||||
|
||||
SessionFactoryBuilder applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling);
|
||||
|
|
|
@ -11,11 +11,9 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.SessionFactoryObserver;
|
||||
import org.hibernate.boot.SessionFactoryBuilder;
|
||||
|
@ -31,7 +29,9 @@ import org.hibernate.cache.spi.TimestampsCacheFactory;
|
|||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||
import org.hibernate.internal.SessionFactoryImpl;
|
||||
import org.hibernate.loader.BatchFetchStyle;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
|
||||
import org.hibernate.resource.jdbc.spi.StatementInspector;
|
||||
|
@ -176,12 +176,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryBuilder applyDefaultEntityMode(EntityMode entityMode) {
|
||||
this.optionsBuilder.applyDefaultEntityMode( entityMode );
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SessionFactoryBuilder applyNullabilityChecking(boolean enabled) {
|
||||
this.optionsBuilder.enableNullabilityChecking( enabled );
|
||||
|
@ -202,7 +196,7 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
|||
|
||||
@Override
|
||||
public SessionFactoryBuilder applyEntityTuplizer(
|
||||
EntityMode entityMode,
|
||||
RepresentationMode entityMode,
|
||||
Class<? extends EntityTuplizer> tuplizerClass) {
|
||||
this.optionsBuilder.applyEntityTuplizer( entityMode, tuplizerClass );
|
||||
return this;
|
||||
|
|
|
@ -21,7 +21,6 @@ import org.hibernate.ConnectionAcquisitionMode;
|
|||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
|
@ -58,6 +57,7 @@ import org.hibernate.internal.util.config.ConfigurationHelper;
|
|||
import org.hibernate.jpa.spi.JpaCompliance;
|
||||
import org.hibernate.jpa.spi.MutableJpaCompliance;
|
||||
import org.hibernate.loader.BatchFetchStyle;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
|
@ -95,7 +95,6 @@ import static org.hibernate.cfg.AvailableSettings.CONVENTIONAL_JAVA_CONSTANTS;
|
|||
import static org.hibernate.cfg.AvailableSettings.CRITERIA_VALUE_HANDLING_MODE;
|
||||
import static org.hibernate.cfg.AvailableSettings.CUSTOM_ENTITY_DIRTINESS_STRATEGY;
|
||||
import static org.hibernate.cfg.AvailableSettings.DEFAULT_BATCH_FETCH_SIZE;
|
||||
import static org.hibernate.cfg.AvailableSettings.DEFAULT_ENTITY_MODE;
|
||||
import static org.hibernate.cfg.AvailableSettings.DELAY_ENTITY_LOADER_CREATIONS;
|
||||
import static org.hibernate.cfg.AvailableSettings.DISCARD_PC_ON_CLOSE;
|
||||
import static org.hibernate.cfg.AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS;
|
||||
|
@ -194,7 +193,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
private List<EntityNameResolver> entityNameResolvers = new ArrayList<>();
|
||||
private EntityNotFoundDelegate entityNotFoundDelegate;
|
||||
private boolean identifierRollbackEnabled;
|
||||
private EntityMode defaultEntityMode;
|
||||
private EntityTuplizerFactory entityTuplizerFactory = new EntityTuplizerFactory();
|
||||
private boolean checkNullability;
|
||||
private boolean initializeLazyStateOutsideTransactions;
|
||||
|
@ -358,7 +356,6 @@ 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 );
|
||||
|
||||
|
@ -968,11 +965,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
return identifierRollbackEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getDefaultEntityMode() {
|
||||
return defaultEntityMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityTuplizerFactory getEntityTuplizerFactory() {
|
||||
return entityTuplizerFactory;
|
||||
|
@ -1336,10 +1328,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
this.identifierRollbackEnabled = enabled;
|
||||
}
|
||||
|
||||
public void applyDefaultEntityMode(EntityMode entityMode) {
|
||||
this.defaultEntityMode = entityMode;
|
||||
}
|
||||
|
||||
public void enableNullabilityChecking(boolean enabled) {
|
||||
this.checkNullability = enabled;
|
||||
}
|
||||
|
@ -1352,7 +1340,7 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
|
|||
this.entityTuplizerFactory = entityTuplizerFactory;
|
||||
}
|
||||
|
||||
public void applyEntityTuplizer(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) {
|
||||
public void applyEntityTuplizer(RepresentationMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) {
|
||||
this.entityTuplizerFactory.registerDefaultTuplizerClass( entityMode, tuplizerClass );
|
||||
}
|
||||
|
||||
|
|
|
@ -6,17 +6,17 @@
|
|||
*/
|
||||
package org.hibernate.boot.jaxb.hbm.internal;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityModeConverter {
|
||||
public static EntityMode fromXml(String name) {
|
||||
return EntityMode.parse( name );
|
||||
public class RepresentationModeConverter {
|
||||
public static RepresentationMode fromXml(String name) {
|
||||
return RepresentationMode.fromExternalName( name );
|
||||
}
|
||||
|
||||
public static String toXml(EntityMode entityMode) {
|
||||
public static String toXml(RepresentationMode entityMode) {
|
||||
return ( null == entityMode ) ? null : entityMode.getExternalName();
|
||||
}
|
||||
}
|
|
@ -13,7 +13,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.jaxb.Origin;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.EntityInfo;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmEntityBaseDefinition;
|
||||
|
@ -23,7 +22,6 @@ import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedNativeQueryType;
|
|||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedQueryType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSecondaryTableType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTuplizerType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.SecondaryTableContainer;
|
||||
import org.hibernate.boot.model.CustomSql;
|
||||
import org.hibernate.boot.model.TruthValue;
|
||||
|
@ -71,8 +69,6 @@ public abstract class AbstractEntitySourceImpl
|
|||
private Map<String,SecondaryTableSource> secondaryTableMap;
|
||||
private final FilterSource[] filterSources;
|
||||
|
||||
private final Map<EntityMode, String> tuplizerClassMap;
|
||||
|
||||
private final ToolingHintContext toolingHintContext;
|
||||
|
||||
protected AbstractEntitySourceImpl(MappingDocument sourceMappingDocument, JaxbHbmEntityBaseDefinition jaxbEntityMapping) {
|
||||
|
@ -84,8 +80,6 @@ public abstract class AbstractEntitySourceImpl
|
|||
this.attributePathBase = new AttributePath();
|
||||
this.attributeRoleBase = new AttributeRole( entityNamingSource.getEntityName() );
|
||||
|
||||
this.tuplizerClassMap = extractTuplizers( jaxbEntityMapping );
|
||||
|
||||
this.filterSources = buildFilterSources();
|
||||
|
||||
for ( JaxbHbmFetchProfileType jaxbFetchProfile : jaxbEntityMapping.getFetchProfile() ) {
|
||||
|
@ -121,21 +115,6 @@ public abstract class AbstractEntitySourceImpl
|
|||
return new EntityNamingSourceImpl( entityName, className, jpaEntityName );
|
||||
}
|
||||
|
||||
private static Map<EntityMode, String> extractTuplizers(JaxbHbmEntityBaseDefinition entityElement) {
|
||||
if ( entityElement.getTuplizer() == null ) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
final Map<EntityMode, String> tuplizers = new HashMap<>();
|
||||
for ( JaxbHbmTuplizerType tuplizerElement : entityElement.getTuplizer() ) {
|
||||
tuplizers.put(
|
||||
tuplizerElement.getEntityMode(),
|
||||
tuplizerElement.getClazz()
|
||||
);
|
||||
}
|
||||
return tuplizers;
|
||||
}
|
||||
|
||||
private FilterSource[] buildFilterSources() {
|
||||
//todo for now, i think all EntityElement should support this.
|
||||
if ( JaxbHbmRootEntityType.class.isInstance( jaxbEntityMapping() ) ) {
|
||||
|
@ -323,15 +302,6 @@ public abstract class AbstractEntitySourceImpl
|
|||
return jaxbEntityMapping.isSelectBeforeUpdate();
|
||||
}
|
||||
|
||||
protected EntityMode determineEntityMode() {
|
||||
return StringHelper.isNotEmpty( entityNamingSource.getClassName() ) ? EntityMode.POJO : EntityMode.MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<EntityMode, String> getTuplizerClassMap() {
|
||||
return tuplizerClassMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCustomPersisterClassName() {
|
||||
return metadataBuildingContext().qualifyClassName( jaxbEntityMapping.getPersister() );
|
||||
|
|
|
@ -7,13 +7,8 @@
|
|||
package org.hibernate.boot.model.source.internal.hbm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTuplizerType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.ToolingHintContainer;
|
||||
import org.hibernate.boot.model.JavaTypeDescriptor;
|
||||
import org.hibernate.boot.model.source.spi.AttributePath;
|
||||
|
@ -25,7 +20,6 @@ import org.hibernate.boot.model.source.spi.EmbeddableSource;
|
|||
import org.hibernate.boot.model.source.spi.LocalMetadataBuildingContext;
|
||||
import org.hibernate.boot.model.source.spi.NaturalIdMutability;
|
||||
import org.hibernate.boot.model.source.spi.ToolingHintContext;
|
||||
import org.hibernate.internal.log.DeprecationLogger;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
|
@ -41,8 +35,6 @@ public class EmbeddableSourceImpl extends AbstractHbmSourceNode implements Embed
|
|||
private final boolean isDynamic;
|
||||
private final boolean isUnique;
|
||||
|
||||
private final Map<EntityMode,String> tuplizerClassMap;
|
||||
|
||||
private final List<AttributeSource> attributeSources;
|
||||
|
||||
public EmbeddableSourceImpl(
|
||||
|
@ -81,23 +73,6 @@ public class EmbeddableSourceImpl extends AbstractHbmSourceNode implements Embed
|
|||
}
|
||||
};
|
||||
|
||||
if ( jaxbEmbeddableMapping.getTuplizer().isEmpty() ) {
|
||||
tuplizerClassMap = Collections.emptyMap();
|
||||
}
|
||||
else {
|
||||
if ( jaxbEmbeddableMapping.getTuplizer().size() > 1 ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfMultipleEntityModeSupport();
|
||||
}
|
||||
|
||||
tuplizerClassMap = new HashMap<>();
|
||||
for ( JaxbHbmTuplizerType tuplizerBinding : jaxbEmbeddableMapping.getTuplizer() ) {
|
||||
tuplizerClassMap.put(
|
||||
tuplizerBinding.getEntityMode(),
|
||||
tuplizerBinding.getClazz()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.attributeSources = new ArrayList<>();
|
||||
AttributesHelper.processAttributes(
|
||||
mappingDocument,
|
||||
|
@ -128,11 +103,6 @@ public class EmbeddableSourceImpl extends AbstractHbmSourceNode implements Embed
|
|||
return jaxbEmbeddableMapping.getParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<EntityMode,String> getTuplizerClassMap() {
|
||||
return tuplizerClassMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return isDynamic;
|
||||
|
|
|
@ -7,11 +7,8 @@
|
|||
package org.hibernate.boot.model.source.internal.hbm;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmPropertiesType;
|
||||
import org.hibernate.boot.model.JavaTypeDescriptor;
|
||||
import org.hibernate.boot.model.source.spi.AttributePath;
|
||||
|
@ -91,11 +88,6 @@ public class EmbeddableSourceVirtualImpl extends AbstractHbmSourceNode implement
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<EntityMode,String> getTuplizerClassMap() {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return false;
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.MappingException;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeIdType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmEntityDiscriminatorType;
|
||||
|
@ -387,11 +386,6 @@ public class EntityHierarchySourceImpl implements EntityHierarchySource {
|
|||
return versionAttributeSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getEntityMode() {
|
||||
return rootEntitySource.determineEntityMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMutable() {
|
||||
return entityElement().isMutable();
|
||||
|
|
|
@ -8,9 +8,7 @@ package org.hibernate.boot.model.source.internal.hbm;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeKeyBasicAttributeType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeKeyManyToOneType;
|
||||
import org.hibernate.boot.model.JavaTypeDescriptor;
|
||||
|
@ -77,11 +75,6 @@ class IdClassSource implements EmbeddableSource {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<EntityMode, String> getTuplizerClassMap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return false;
|
||||
|
|
|
@ -8,9 +8,7 @@ package org.hibernate.boot.model.source.internal.hbm;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmCompositeIdType;
|
||||
import org.hibernate.boot.model.IdentifierGeneratorDefinition;
|
||||
import org.hibernate.boot.model.JavaTypeDescriptor;
|
||||
|
@ -152,11 +150,6 @@ class IdentifierSourceNonAggregatedCompositeImpl implements IdentifierSourceNonA
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<EntityMode, String> getTuplizerClassMap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return false;
|
||||
|
|
|
@ -17,7 +17,6 @@ import java.util.Objects;
|
|||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.boot.MappingException;
|
||||
import org.hibernate.boot.jaxb.Origin;
|
||||
|
@ -437,22 +436,6 @@ public class ModelBinder {
|
|||
);
|
||||
}
|
||||
|
||||
if ( entitySource.getTuplizerClassMap() != null ) {
|
||||
if ( entitySource.getTuplizerClassMap().size() > 1 ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfMultipleEntityModeSupport();
|
||||
}
|
||||
for ( Map.Entry<EntityMode,String> tuplizerEntry : entitySource.getTuplizerClassMap().entrySet() ) {
|
||||
entityDescriptor.addTuplizer(
|
||||
tuplizerEntry.getKey(),
|
||||
tuplizerEntry.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ( StringHelper.isNotEmpty( entitySource.getXmlNodeName() ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
|
||||
entityDescriptor.setDynamicInsert( entitySource.isDynamicInsert() );
|
||||
entityDescriptor.setDynamicUpdate( entitySource.isDynamicUpdate() );
|
||||
entityDescriptor.setBatchSize( entitySource.getBatchSize() );
|
||||
|
@ -1909,10 +1892,6 @@ public class ModelBinder {
|
|||
attribute
|
||||
);
|
||||
|
||||
if ( StringHelper.isNotEmpty( embeddedSource.getXmlNodeName() ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
|
||||
return attribute;
|
||||
}
|
||||
|
||||
|
@ -2585,10 +2564,6 @@ public class ModelBinder {
|
|||
Property property) {
|
||||
property.setName( propertySource.getName() );
|
||||
|
||||
if ( StringHelper.isNotEmpty( propertySource.getXmlNodeName() ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
|
||||
property.setPropertyAccessorName(
|
||||
StringHelper.isNotEmpty( propertySource.getPropertyAccessorName() )
|
||||
? propertySource.getPropertyAccessorName()
|
||||
|
@ -2769,11 +2744,6 @@ public class ModelBinder {
|
|||
}
|
||||
}
|
||||
|
||||
String nodeName = xmlNodeName;
|
||||
if ( StringHelper.isNotEmpty( nodeName ) ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfDomEntityModeSupport();
|
||||
}
|
||||
|
||||
// todo : anything else to pass along?
|
||||
bindAllCompositeAttributes(
|
||||
sourceDocument,
|
||||
|
@ -2799,18 +2769,6 @@ public class ModelBinder {
|
|||
// todo : we may need to delay this
|
||||
componentBinding.getOwner().getTable().createUniqueKey( cols );
|
||||
}
|
||||
|
||||
if ( embeddableSource.getTuplizerClassMap() != null ) {
|
||||
if ( embeddableSource.getTuplizerClassMap().size() > 1 ) {
|
||||
DeprecationLogger.DEPRECATION_LOGGER.logDeprecationOfMultipleEntityModeSupport();
|
||||
}
|
||||
for ( Map.Entry<EntityMode,String> tuplizerEntry : embeddableSource.getTuplizerClassMap().entrySet() ) {
|
||||
componentBinding.addTuplizer(
|
||||
tuplizerEntry.getKey(),
|
||||
tuplizerEntry.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareComponentType(
|
||||
|
|
|
@ -6,9 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.boot.model.source.spi;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.model.JavaTypeDescriptor;
|
||||
|
||||
/**
|
||||
|
@ -21,11 +18,9 @@ import org.hibernate.boot.model.JavaTypeDescriptor;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface EmbeddableSource extends AttributeSourceContainer {
|
||||
public JavaTypeDescriptor getTypeDescriptor();
|
||||
JavaTypeDescriptor getTypeDescriptor();
|
||||
|
||||
public String getParentReferenceAttributeName();
|
||||
|
||||
public Map<EntityMode,String> getTuplizerClassMap();
|
||||
String getParentReferenceAttributeName();
|
||||
|
||||
/**
|
||||
* Indicates whether this embeddable/component is dynamic (represented as a Map),
|
||||
|
@ -35,7 +30,7 @@ public interface EmbeddableSource extends AttributeSourceContainer {
|
|||
* {@code false} indicates there is a dedicated class for representing the
|
||||
* composition.
|
||||
*/
|
||||
public boolean isDynamic();
|
||||
boolean isDynamic();
|
||||
|
||||
public boolean isUnique();
|
||||
boolean isUnique();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.boot.model.source.spi;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.model.Caching;
|
||||
import org.hibernate.engine.OptimisticLockStyle;
|
||||
|
||||
|
@ -60,13 +59,6 @@ public interface EntityHierarchySource {
|
|||
*/
|
||||
public MultiTenancySource getMultiTenancySource();
|
||||
|
||||
/**
|
||||
* Obtain the entity mode for this entity.
|
||||
*
|
||||
* @return The entity mode.
|
||||
*/
|
||||
public EntityMode getEntityMode();
|
||||
|
||||
/**
|
||||
* Is this root entity mutable?
|
||||
*
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.boot.model.source.spi;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedNativeQueryType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNamedQueryType;
|
||||
import org.hibernate.boot.model.CustomSql;
|
||||
|
@ -37,13 +36,6 @@ public interface EntitySource extends IdentifiableTypeSource, ToolingHintContext
|
|||
|
||||
String getXmlNodeName();
|
||||
|
||||
/**
|
||||
* Obtain the named custom tuplizer classes to be used.
|
||||
*
|
||||
* @return The custom tuplizer class names
|
||||
*/
|
||||
Map<EntityMode,String> getTuplizerClassMap();
|
||||
|
||||
/**
|
||||
* Obtain the name of a custom persister class to be used.
|
||||
*
|
||||
|
|
|
@ -11,11 +11,9 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.SessionFactoryObserver;
|
||||
import org.hibernate.boot.SessionFactoryBuilder;
|
||||
|
@ -23,7 +21,9 @@ import org.hibernate.boot.TempTableDdlTransactionHandling;
|
|||
import org.hibernate.cache.spi.TimestampsCacheFactory;
|
||||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||
import org.hibernate.loader.BatchFetchStyle;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.query.sqm.function.SqmFunctionDescriptor;
|
||||
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
|
||||
import org.hibernate.resource.jdbc.spi.StatementInspector;
|
||||
|
@ -141,13 +141,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionF
|
|||
return getThis();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public T applyDefaultEntityMode(EntityMode entityMode) {
|
||||
delegate.applyDefaultEntityMode( entityMode );
|
||||
return getThis();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T applyNullabilityChecking(boolean enabled) {
|
||||
delegate.applyNullabilityChecking( enabled );
|
||||
|
@ -168,7 +161,7 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionF
|
|||
|
||||
@Override
|
||||
public T applyEntityTuplizer(
|
||||
EntityMode entityMode,
|
||||
RepresentationMode entityMode,
|
||||
Class<? extends EntityTuplizer> tuplizerClass) {
|
||||
delegate.applyEntityTuplizer( entityMode, tuplizerClass );
|
||||
return getThis();
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
|
@ -150,11 +149,6 @@ public class AbstractDelegatingSessionFactoryOptions implements SessionFactoryOp
|
|||
return delegate.isIdentifierRollbackEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getDefaultEntityMode() {
|
||||
return delegate.getDefaultEntityMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityTuplizerFactory getEntityTuplizerFactory() {
|
||||
return delegate.getEntityTuplizerFactory();
|
||||
|
|
|
@ -12,14 +12,12 @@ import java.util.function.Supplier;
|
|||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.CustomEntityDirtinessStrategy;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.TimeZoneStorageStrategy;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.SessionFactoryObserver;
|
||||
import org.hibernate.TimeZoneStorageStrategy;
|
||||
import org.hibernate.boot.SchemaAutoTooling;
|
||||
import org.hibernate.boot.TempTableDdlTransactionHandling;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
|
@ -31,6 +29,7 @@ import org.hibernate.jpa.spi.JpaCompliance;
|
|||
import org.hibernate.loader.BatchFetchStyle;
|
||||
import org.hibernate.proxy.EntityNotFoundDelegate;
|
||||
import org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.query.criteria.ValueHandlingMode;
|
||||
import org.hibernate.query.spi.QueryEngineOptions;
|
||||
import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode;
|
||||
|
@ -149,8 +148,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
|
|||
|
||||
boolean isIdentifierRollbackEnabled();
|
||||
|
||||
EntityMode getDefaultEntityMode();
|
||||
|
||||
EntityTuplizerFactory getEntityTuplizerFactory();
|
||||
|
||||
boolean isCheckNullability();
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.bytecode.BytecodeLogging;
|
||||
|
@ -70,8 +69,7 @@ public class EnhancementAsProxyLazinessInterceptor extends AbstractLazyLoadInter
|
|||
}
|
||||
}
|
||||
|
||||
this.inLineDirtyChecking = entityPersister.getEntityMode() == EntityMode.POJO
|
||||
&& SelfDirtinessTracker.class.isAssignableFrom( entityPersister.getMappedClass() );
|
||||
this.inLineDirtyChecking = SelfDirtinessTracker.class.isAssignableFrom( entityPersister.getMappedClass() );
|
||||
// if self-dirty tracking is enabled but DynamicUpdate is not enabled then we need to initialise the entity
|
||||
// because the pre-computed update statement contains even not dirty properties and so we need all the values
|
||||
initializeBeforeWrite = !( inLineDirtyChecking && entityPersister.getEntityMetamodel().isDynamicUpdate() );
|
||||
|
|
|
@ -1322,11 +1322,6 @@ public interface AvailableSettings {
|
|||
|
||||
// Still to categorize
|
||||
|
||||
/**
|
||||
* The EntityMode in which set the Session opened from the SessionFactory.
|
||||
*/
|
||||
String DEFAULT_ENTITY_MODE = "hibernate.default_entity_mode";
|
||||
|
||||
/**
|
||||
* Should all database identifiers be quoted. A {@code true}/{@code false} option.
|
||||
*/
|
||||
|
|
|
@ -9,9 +9,7 @@ package org.hibernate.cfg;
|
|||
import java.util.Map;
|
||||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.SchemaAutoTooling;
|
||||
import org.hibernate.boot.model.naming.Identifier;
|
||||
|
@ -20,6 +18,7 @@ import org.hibernate.cache.spi.RegionFactory;
|
|||
import org.hibernate.cache.spi.TimestampsCacheFactory;
|
||||
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
|
||||
import org.hibernate.loader.BatchFetchStyle;
|
||||
import org.hibernate.query.NullPrecedence;
|
||||
import org.hibernate.tuple.entity.EntityTuplizerFactory;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
@ -70,7 +69,6 @@ public final class Settings {
|
|||
LOG.debugf( "Statistics: %s", enabledDisabled( sessionFactoryOptions.isStatisticsEnabled() ) );
|
||||
|
||||
LOG.debugf( "Deleted entity synthetic identifier rollback: %s", enabledDisabled( sessionFactoryOptions.isIdentifierRollbackEnabled() ) );
|
||||
LOG.debugf( "Default entity-mode: %s", sessionFactoryOptions.getDefaultEntityMode() );
|
||||
LOG.debugf( "Check Nullability in Core (should be disabled when Bean Validation is on): %s", enabledDisabled( sessionFactoryOptions.isCheckNullability() ) );
|
||||
LOG.debugf( "Allow initialization of lazy state outside session : %s", enabledDisabled( sessionFactoryOptions.isInitializeLazyStateOutsideTransactionsEnabled() ) );
|
||||
|
||||
|
@ -153,10 +151,6 @@ public final class Settings {
|
|||
return sessionFactoryOptions.isIdentifierRollbackEnabled();
|
||||
}
|
||||
|
||||
public EntityMode getDefaultEntityMode() {
|
||||
return sessionFactoryOptions.getDefaultEntityMode();
|
||||
}
|
||||
|
||||
public EntityTuplizerFactory getEntityTuplizerFactory() {
|
||||
return sessionFactoryOptions.getEntityTuplizerFactory();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.Set;
|
|||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
|
@ -83,7 +82,7 @@ public class PersistentSortedMap<K,E> extends PersistentMap<K,E> implements Sort
|
|||
}
|
||||
|
||||
@SuppressWarnings("UnusedParameters")
|
||||
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode) throws HibernateException {
|
||||
protected Serializable snapshot(BasicCollectionPersister persister) throws HibernateException {
|
||||
final TreeMap<K,E> clonedMap = new TreeMap<>( comparator );
|
||||
for ( Entry<K,E> e : map.entrySet() ) {
|
||||
clonedMap.put( e.getKey(), (E) persister.getElementType().deepCopy( e.getValue(), persister.getFactory() ) );
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Comparator;
|
|||
import java.util.SortedSet;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
|
@ -80,7 +79,7 @@ public class PersistentSortedSet<E> extends PersistentSet<E> implements SortedSe
|
|||
}
|
||||
|
||||
@SuppressWarnings("UnusedParameters")
|
||||
protected Serializable snapshot(BasicCollectionPersister persister, EntityMode entityMode)
|
||||
protected Serializable snapshot(BasicCollectionPersister persister)
|
||||
throws HibernateException {
|
||||
final TreeMap<E,E> clonedSet = new TreeMap<>( comparator );
|
||||
for ( E setElement : set ) {
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.internal;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.TransientObjectException;
|
||||
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
|
||||
|
@ -133,7 +132,7 @@ public final class ForeignKeys {
|
|||
}
|
||||
if ( substitute ) {
|
||||
// todo : need to account for entity mode on the CompositeType interface :(
|
||||
actype.setPropertyValues( value, subvalues, EntityMode.POJO );
|
||||
actype.setPropertyValues( value, subvalues );
|
||||
}
|
||||
returnedValue = value;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.engine.internal;
|
|||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.engine.spi.EntityEntry;
|
||||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
|
@ -40,7 +39,6 @@ public final class MutableEntityEntry extends AbstractEntityEntry {
|
|||
final LockMode lockMode,
|
||||
final boolean existsInDatabase,
|
||||
final EntityPersister persister,
|
||||
final EntityMode entityMode,
|
||||
final String tenantId,
|
||||
final boolean disableVersionIncrement,
|
||||
final PersistenceContext persistenceContext) {
|
||||
|
|
|
@ -805,7 +805,6 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
collectionType.getLHSPropertyName(),
|
||||
key,
|
||||
collectionPersister.getKeyType(),
|
||||
ownerPersister.getEntityMode(),
|
||||
session.getFactory()
|
||||
)
|
||||
);
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.io.ObjectInputStream;
|
|||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -37,15 +36,6 @@ public final class CollectionKey implements Serializable {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The EntityMode parameter is now ignored. Use the other constructor.
|
||||
* @deprecated Use {@link #CollectionKey(CollectionPersister, Object)}
|
||||
*/
|
||||
@Deprecated
|
||||
public CollectionKey(CollectionPersister persister, Object key, EntityMode em) {
|
||||
this( persister.getRole(), key, persister.getKeyType(), persister.getFactory() );
|
||||
}
|
||||
|
||||
private CollectionKey(
|
||||
String role,
|
||||
Object key,
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.io.ObjectInputStream;
|
|||
import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -30,7 +29,6 @@ public class EntityUniqueKey implements Serializable {
|
|||
private final String entityName;
|
||||
private final Object key;
|
||||
private final Type keyType;
|
||||
private final EntityMode entityMode;
|
||||
private final int hashCode;
|
||||
|
||||
public EntityUniqueKey(
|
||||
|
@ -38,13 +36,11 @@ public class EntityUniqueKey implements Serializable {
|
|||
final String uniqueKeyName,
|
||||
final Object key,
|
||||
final Type keyType,
|
||||
final EntityMode entityMode,
|
||||
final SessionFactoryImplementor factory) {
|
||||
this.uniqueKeyName = uniqueKeyName;
|
||||
this.entityName = entityName;
|
||||
this.key = key;
|
||||
this.keyType = keyType;
|
||||
this.entityMode = entityMode;
|
||||
this.hashCode = generateHashCode( factory );
|
||||
}
|
||||
|
||||
|
@ -117,7 +113,6 @@ public class EntityUniqueKey implements Serializable {
|
|||
oos.writeObject( entityName );
|
||||
oos.writeObject( key );
|
||||
oos.writeObject( keyType );
|
||||
oos.writeObject( entityMode );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,7 +135,6 @@ public class EntityUniqueKey implements Serializable {
|
|||
(String) ois.readObject(),
|
||||
ois.readObject(),
|
||||
(Type) ois.readObject(),
|
||||
(EntityMode) ois.readObject(),
|
||||
session.getFactory()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.io.IOException;
|
|||
import java.io.ObjectInputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.internal.util.ValueHolder;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -32,14 +31,6 @@ public final class TypedValue implements Serializable {
|
|||
initTransients();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated explicit entity mode support is deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public TypedValue(Type type, Object value, EntityMode entityMode) {
|
||||
this(type, value);
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.event.internal;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.enhance.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementAsProxyLazinessInterceptor;
|
||||
|
@ -147,7 +146,7 @@ public class WrapVisitor extends ProxyVisitor {
|
|||
}
|
||||
}
|
||||
if ( substituteComponent ) {
|
||||
componentType.setPropertyValues( component, values, EntityMode.POJO );
|
||||
componentType.setPropertyValues( component, values );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,13 +6,10 @@
|
|||
*/
|
||||
package org.hibernate.internal;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Connection;
|
||||
import java.util.Set;
|
||||
import jakarta.transaction.SystemException;
|
||||
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
|
@ -35,6 +32,8 @@ import org.hibernate.pretty.MessageHelper;
|
|||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
|
||||
import jakarta.transaction.SystemException;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
* @author Steve Ebersole
|
||||
|
@ -450,10 +449,6 @@ public class StatelessSessionImpl extends AbstractSharedSessionContract implemen
|
|||
return null;
|
||||
}
|
||||
|
||||
public EntityMode getEntityMode() {
|
||||
return EntityMode.POJO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String guessEntityName(Object entity) throws HibernateException {
|
||||
checkOpen();
|
||||
|
|
|
@ -42,16 +42,6 @@ public interface DeprecationLogger extends BasicLogger {
|
|||
)
|
||||
public void logDeprecatedScannerSetting();
|
||||
|
||||
/**
|
||||
* Log message indicating the use of multiple EntityModes for a single entity.
|
||||
*/
|
||||
@LogMessage( level = WARN )
|
||||
@Message(
|
||||
value = "Support for an entity defining multiple entity-modes is deprecated",
|
||||
id = 90000002
|
||||
)
|
||||
public void logDeprecationOfMultipleEntityModeSupport();
|
||||
|
||||
/**
|
||||
* Log message indicating the use of features that were only useful for DOM4J EntityMode,
|
||||
* which was removed a long time ago.
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.model.relational.Database;
|
||||
import org.hibernate.boot.model.relational.ExportableProducer;
|
||||
|
@ -29,6 +28,7 @@ import org.hibernate.id.IdentifierGenerator;
|
|||
import org.hibernate.id.factory.IdentifierGeneratorFactory;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.internal.util.collections.JoinedIterator;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.property.access.spi.Setter;
|
||||
import org.hibernate.tuple.component.ComponentMetamodel;
|
||||
import org.hibernate.type.ComponentType;
|
||||
|
@ -54,7 +54,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
private boolean isKey;
|
||||
private String roleName;
|
||||
|
||||
private Map<EntityMode,String> tuplizerImpls;
|
||||
private Map<RepresentationMode,String> tuplizerImpls;
|
||||
|
||||
// cache the status of the type
|
||||
private volatile Type type;
|
||||
|
@ -327,14 +327,14 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
return componentClassName!=null;
|
||||
}
|
||||
|
||||
public void addTuplizer(EntityMode entityMode, String implClassName) {
|
||||
public void addTuplizer(RepresentationMode representationMode, String implClassName) {
|
||||
if ( tuplizerImpls == null ) {
|
||||
tuplizerImpls = new HashMap<>();
|
||||
}
|
||||
tuplizerImpls.put( entityMode, implClassName );
|
||||
tuplizerImpls.put( representationMode, implClassName );
|
||||
}
|
||||
|
||||
public String getTuplizerImplClassName(EntityMode mode) {
|
||||
public String getTuplizerImplClassName(RepresentationMode mode) {
|
||||
// todo : remove this once ComponentMetamodel is complete and merged
|
||||
if ( tuplizerImpls == null ) {
|
||||
return null;
|
||||
|
|
|
@ -10,13 +10,11 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.model.CustomSql;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
|
@ -28,6 +26,7 @@ import org.hibernate.internal.FilterConfiguration;
|
|||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.JoinedIterator;
|
||||
import org.hibernate.internal.util.collections.SingletonIterator;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.jpa.event.spi.CallbackDefinition;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
@ -1015,14 +1014,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
this.identifierMapper = handle;
|
||||
}
|
||||
|
||||
public void addTuplizer(EntityMode entityMode, String implClassName) {
|
||||
if ( tuplizerImpls == null ) {
|
||||
tuplizerImpls = new HashMap();
|
||||
}
|
||||
tuplizerImpls.put( entityMode, implClassName );
|
||||
}
|
||||
|
||||
public String getTuplizerImplClassName(EntityMode mode) {
|
||||
public String getTuplizerImplClassName(RepresentationMode mode) {
|
||||
if ( tuplizerImpls == null ) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Collections;
|
|||
import java.util.Iterator;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.PropertyNotFoundException;
|
||||
|
@ -21,6 +20,7 @@ import org.hibernate.engine.spi.CascadeStyle;
|
|||
import org.hibernate.engine.spi.CascadeStyles;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.jpa.event.spi.CallbackDefinition;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.property.access.spi.Getter;
|
||||
import org.hibernate.property.access.spi.PropertyAccessStrategy;
|
||||
import org.hibernate.property.access.spi.PropertyAccessStrategyResolver;
|
||||
|
@ -301,7 +301,7 @@ public class Property implements Serializable, MetaAttributable {
|
|||
this.selectable = selectable;
|
||||
}
|
||||
|
||||
public String getAccessorPropertyName( EntityMode mode ) {
|
||||
public String getAccessorPropertyName(RepresentationMode mode) {
|
||||
return getName();
|
||||
}
|
||||
|
||||
|
@ -327,14 +327,14 @@ public class Property implements Serializable, MetaAttributable {
|
|||
}
|
||||
}
|
||||
|
||||
final EntityMode entityMode = clazz == null || java.util.Map.class.equals( clazz )
|
||||
? EntityMode.MAP
|
||||
: EntityMode.POJO;
|
||||
final RepresentationMode representationMode = clazz == null || java.util.Map.class.equals( clazz )
|
||||
? RepresentationMode.MAP
|
||||
: RepresentationMode.POJO;
|
||||
|
||||
return resolveServiceRegistry().getService( PropertyAccessStrategyResolver.class ).resolvePropertyAccessStrategy(
|
||||
clazz,
|
||||
accessName,
|
||||
entityMode
|
||||
representationMode
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.engine.OptimisticLockStyle;
|
||||
import org.hibernate.internal.FilterConfiguration;
|
||||
import org.hibernate.internal.util.collections.JoinedIterator;
|
||||
import org.hibernate.internal.util.collections.SingletonIterator;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
/**
|
||||
|
@ -249,7 +249,7 @@ public class Subclass extends PersistentClass {
|
|||
getSuperclass().hasSubselectLoadableCollections();
|
||||
}
|
||||
|
||||
public String getTuplizerImplClassName(EntityMode mode) {
|
||||
public String getTuplizerImplClassName(RepresentationMode mode) {
|
||||
String impl = super.getTuplizerImplClassName( mode );
|
||||
if ( impl == null ) {
|
||||
impl = getSuperclass().getTuplizerImplClassName( mode );
|
||||
|
|
|
@ -8,8 +8,6 @@ package org.hibernate.metamodel;
|
|||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
|
||||
/**
|
||||
* Enumeration of the built-in ways that Hibernate can represent the
|
||||
* application's domain model.
|
||||
|
@ -17,36 +15,25 @@ import org.hibernate.EntityMode;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public enum RepresentationMode {
|
||||
POJO( "pojo", EntityMode.POJO ),
|
||||
MAP( "map", "dynamic-map", EntityMode.MAP );
|
||||
POJO( "pojo" ),
|
||||
MAP( "dynamic-map", "map" );
|
||||
|
||||
private final String externalName;
|
||||
private final String alternativeExternalName;
|
||||
|
||||
private final EntityMode legacyEntityMode;
|
||||
|
||||
RepresentationMode(String externalName, EntityMode legacyEntityMode) {
|
||||
this ( externalName, null, legacyEntityMode );
|
||||
RepresentationMode(String externalName) {
|
||||
this ( externalName, null );
|
||||
}
|
||||
|
||||
RepresentationMode(String externalName, String alternativeExternalName, EntityMode legacyEntityMode) {
|
||||
RepresentationMode(String externalName, String alternativeExternalName) {
|
||||
this.externalName = externalName;
|
||||
this.alternativeExternalName = alternativeExternalName;
|
||||
this.legacyEntityMode = legacyEntityMode;
|
||||
}
|
||||
|
||||
public String getExternalName() {
|
||||
return externalName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated {@link EntityMode} is deprecated itself
|
||||
*/
|
||||
@Deprecated
|
||||
public EntityMode getLegacyEntityMode() {
|
||||
return legacyEntityMode;
|
||||
}
|
||||
|
||||
public static RepresentationMode fromExternalName(String externalName) {
|
||||
if ( externalName == null ) {
|
||||
return POJO;
|
||||
|
|
|
@ -10,19 +10,20 @@ import org.hibernate.Incubating;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
|
||||
/**
|
||||
* Strategy for instantiating representation structure instances.
|
||||
* Strategy for instantiating a managed type
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
@Incubating
|
||||
public interface Instantiator {
|
||||
|
||||
/**
|
||||
* Performs and "instance of" check to see if the given object is an
|
||||
* instance of managed structure
|
||||
* @see Class#isInstance
|
||||
*/
|
||||
boolean isInstance(Object object, SessionFactoryImplementor sessionFactory);
|
||||
|
||||
boolean isSameClass(Object object, SessionFactoryImplementor sessionFactory);
|
||||
|
||||
}
|
||||
/**
|
||||
* @see Class#equals
|
||||
*/
|
||||
boolean isSameClass(Object object, SessionFactoryImplementor sessionFactory);}
|
||||
|
|
|
@ -33,7 +33,6 @@ import java.util.function.Consumer;
|
|||
import java.util.function.Supplier;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.Filter;
|
||||
import org.hibernate.HibernateException;
|
||||
|
@ -5299,11 +5298,6 @@ public abstract class AbstractEntityPersister
|
|||
return representationStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getEntityMode() {
|
||||
return getRepresentationStrategy().getMode().getLegacyEntityMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityTuplizer getEntityTuplizer() {
|
||||
return null;
|
||||
|
|
|
@ -13,7 +13,6 @@ import java.sql.SQLException;
|
|||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.jdbc.Size;
|
||||
|
@ -21,6 +20,7 @@ import org.hibernate.engine.spi.Mapping;
|
|||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.type.AbstractType;
|
||||
import org.hibernate.type.BasicType;
|
||||
|
@ -113,7 +113,9 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
|||
throw new HibernateException( "Unable to resolve discriminator value [" + discriminatorValue + "] to entity name" );
|
||||
}
|
||||
final EntityPersister entityPersister = session.getEntityPersister( entityName, null );
|
||||
return ( EntityMode.POJO == entityPersister.getEntityMode() ) ? entityPersister.getMappedClass() : entityName;
|
||||
return entityPersister.getRepresentationStrategy().getMode() == RepresentationMode.POJO
|
||||
? entityPersister.getJavaTypeDescriptor().getJavaTypeClass()
|
||||
: entityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -211,11 +213,12 @@ public class DiscriminatorType<T> extends AbstractType implements BasicType<T>,
|
|||
return underlyingType.canDoExtraction();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public JavaType<T> getExpressableJavaTypeDescriptor() {
|
||||
return (JavaType<T>) ( EntityMode.POJO == persister.getEntityMode() ?
|
||||
ClassJavaTypeDescriptor.INSTANCE :
|
||||
StringJavaTypeDescriptor.INSTANCE );
|
||||
return (JavaType<T>) (persister.getRepresentationStrategy().getMode() == RepresentationMode.POJO
|
||||
? ClassJavaTypeDescriptor.INSTANCE
|
||||
: StringJavaTypeDescriptor.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
|
@ -886,12 +885,6 @@ public interface EntityPersister
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getRepresentationStrategy()}
|
||||
*/
|
||||
@Deprecated
|
||||
EntityMode getEntityMode();
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getRepresentationStrategy()}
|
||||
*/
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
package org.hibernate.property.access.internal;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.registry.selector.spi.StrategySelector;
|
||||
import org.hibernate.engine.spi.Managed;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.property.access.spi.BuiltInPropertyAccessStrategies;
|
||||
import org.hibernate.property.access.spi.PropertyAccessStrategy;
|
||||
import org.hibernate.property.access.spi.PropertyAccessStrategyResolver;
|
||||
|
@ -32,7 +32,7 @@ public class PropertyAccessStrategyResolverStandardImpl implements PropertyAcces
|
|||
public PropertyAccessStrategy resolvePropertyAccessStrategy(
|
||||
Class containerClass,
|
||||
String explicitAccessStrategyName,
|
||||
EntityMode entityMode) {
|
||||
RepresentationMode representationMode) {
|
||||
|
||||
if ( BuiltInPropertyAccessStrategies.BASIC.getExternalName().equals( explicitAccessStrategyName )
|
||||
|| BuiltInPropertyAccessStrategies.FIELD.getExternalName().equals( explicitAccessStrategyName )
|
||||
|
@ -47,7 +47,7 @@ public class PropertyAccessStrategyResolverStandardImpl implements PropertyAcces
|
|||
return resolveExplicitlyNamedPropertyAccessStrategy( explicitAccessStrategyName );
|
||||
}
|
||||
|
||||
if ( entityMode == EntityMode.MAP ) {
|
||||
if ( representationMode == RepresentationMode.MAP ) {
|
||||
return BuiltInPropertyAccessStrategies.MAP.getStrategy();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
package org.hibernate.property.access.spi;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.service.Service;
|
||||
|
||||
/**
|
||||
|
@ -22,12 +22,12 @@ public interface PropertyAccessStrategyResolver extends Service {
|
|||
*
|
||||
* @param containerClass The java class of the entity
|
||||
* @param explicitAccessStrategyName The access strategy name explicitly specified, if any.
|
||||
* @param entityMode The entity mode in effect for the property, used to interpret different default strategies.
|
||||
* @param representationMode The entity mode in effect for the property, used to interpret different default strategies.
|
||||
*
|
||||
* @return The resolved PropertyAccessStrategy
|
||||
*/
|
||||
PropertyAccessStrategy resolvePropertyAccessStrategy(
|
||||
Class containerClass,
|
||||
String explicitAccessStrategyName,
|
||||
EntityMode entityMode);
|
||||
RepresentationMode representationMode);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ public class EntitySelectFetchByUniqueKeyInitializer extends EntitySelectFetchIn
|
|||
uniqueKeyPropertyName,
|
||||
entityIdentifier,
|
||||
concreteDescriptor.getIdentifierType(),
|
||||
concreteDescriptor.getEntityMode(),
|
||||
session.getFactory()
|
||||
);
|
||||
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
||||
|
|
|
@ -247,7 +247,6 @@ public class CircularBiDirectionalFetchImpl implements BiDirectionalFetch, Assoc
|
|||
uniqueKeyPropertyName,
|
||||
key,
|
||||
entityPersister.getIdentifierType(),
|
||||
entityPersister.getEntityMode(),
|
||||
session.getFactory()
|
||||
);
|
||||
Object entityInstance = persistenceContext.getEntity( euk );
|
||||
|
|
|
@ -8,20 +8,17 @@ package org.hibernate.tuple;
|
|||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementHelper;
|
||||
import org.hibernate.engine.internal.UnsavedValueFactory;
|
||||
import org.hibernate.engine.spi.IdentifierValue;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.VersionValue;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.mapping.KeyValue;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.spi.PersisterCreationContext;
|
||||
import org.hibernate.property.access.spi.Getter;
|
||||
|
@ -33,10 +30,8 @@ import org.hibernate.tuple.entity.EntityBasedBasicAttribute;
|
|||
import org.hibernate.tuple.entity.EntityBasedCompositionAttribute;
|
||||
import org.hibernate.tuple.entity.VersionProperty;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.CompositeType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.descriptor.java.VersionJavaType;
|
||||
|
||||
/**
|
||||
* Responsible for generation of runtime metamodel {@link Property} representations.
|
||||
|
@ -319,7 +314,7 @@ public final class PropertyFactory {
|
|||
final PropertyAccessStrategy propertyAccessStrategy = propertyAccessStrategyResolver.resolvePropertyAccessStrategy(
|
||||
mappingProperty.getClass(),
|
||||
mappingProperty.getPropertyAccessorName(),
|
||||
EntityMode.POJO
|
||||
RepresentationMode.POJO
|
||||
);
|
||||
|
||||
final PropertyAccess propertyAccess = propertyAccessStrategy.buildPropertyAccess(
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
*/
|
||||
package org.hibernate.tuple;
|
||||
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.property.access.spi.Getter;
|
||||
|
||||
/**
|
||||
* A tuplizer defines the contract for things which know how to manage
|
||||
* a particular representation of a piece of data, given that
|
||||
* representation's {@link org.hibernate.EntityMode} (the entity-mode
|
||||
* representation's {@link RepresentationMode} (the entity-mode
|
||||
* essentially defining which representation).
|
||||
* </p>
|
||||
* If that given piece of data is thought of as a data structure, then a tuplizer
|
||||
|
|
|
@ -11,7 +11,6 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||
import org.hibernate.cfg.Environment;
|
||||
|
@ -19,6 +18,7 @@ import org.hibernate.engine.config.spi.ConfigurationService;
|
|||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.tuple.PropertyFactory;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class ComponentMetamodel implements Serializable {
|
|||
private final boolean isKey;
|
||||
private final StandardProperty[] properties;
|
||||
|
||||
private final EntityMode entityMode;
|
||||
private final RepresentationMode representationMode;
|
||||
private final ComponentTuplizer componentTuplizer;
|
||||
|
||||
// cached for efficiency...
|
||||
|
@ -62,12 +62,12 @@ public class ComponentMetamodel implements Serializable {
|
|||
i++;
|
||||
}
|
||||
|
||||
entityMode = component.hasPojoRepresentation() ? EntityMode.POJO : EntityMode.MAP;
|
||||
representationMode = component.hasPojoRepresentation() ? RepresentationMode.POJO : RepresentationMode.MAP;
|
||||
|
||||
// todo : move this to SF per HHH-3517; also see HHH-1907 and ComponentMetamodel
|
||||
final String tuplizerClassName = component.getTuplizerImplClassName( entityMode );
|
||||
final String tuplizerClassName = component.getTuplizerImplClassName( representationMode );
|
||||
this.componentTuplizer = tuplizerClassName == null ? componentTuplizerFactory.constructDefaultTuplizer(
|
||||
entityMode,
|
||||
representationMode,
|
||||
component
|
||||
) : componentTuplizerFactory.constructTuplizer( tuplizerClassName, component );
|
||||
|
||||
|
@ -112,8 +112,8 @@ public class ComponentMetamodel implements Serializable {
|
|||
return getProperty( getPropertyIndex( propertyName ) );
|
||||
}
|
||||
|
||||
public EntityMode getEntityMode() {
|
||||
return entityMode;
|
||||
public RepresentationMode getRepresentationMode() {
|
||||
return representationMode;
|
||||
}
|
||||
|
||||
public ComponentTuplizer getComponentTuplizer() {
|
||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.internal.ClassLoaderAccessImpl;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
|
@ -22,16 +21,17 @@ import org.hibernate.boot.spi.ClassLoaderAccess;
|
|||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
/**
|
||||
* A registry allowing users to define the default {@link ComponentTuplizer} class to use per {@link EntityMode}.
|
||||
* A registry allowing users to define the default {@link ComponentTuplizer} class to use per {@link RepresentationMode}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ComponentTuplizerFactory implements Serializable {
|
||||
private static final Class[] COMPONENT_TUP_CTOR_SIG = new Class[] { Component.class };
|
||||
|
||||
private Map<EntityMode,Class<? extends ComponentTuplizer>> defaultImplClassByMode = buildBaseMapping();
|
||||
private final Map<RepresentationMode,Class<? extends ComponentTuplizer>> defaultImplClassByMode = buildBaseMapping();
|
||||
|
||||
private final ClassLoaderAccess classLoaderAccess;
|
||||
|
||||
|
@ -53,17 +53,17 @@ public class ComponentTuplizerFactory implements Serializable {
|
|||
/**
|
||||
* Method allowing registration of the tuplizer class to use as default for a particular entity-mode.
|
||||
*
|
||||
* @param entityMode The entity-mode for which to register the tuplizer class
|
||||
* @param representationMode The entity-mode for which to register the tuplizer class
|
||||
* @param tuplizerClass The class to use as the default tuplizer for the given entity-mode.
|
||||
*/
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
public void registerDefaultTuplizerClass(EntityMode entityMode, Class<? extends ComponentTuplizer> tuplizerClass) {
|
||||
public void registerDefaultTuplizerClass(RepresentationMode representationMode, Class<? extends ComponentTuplizer> tuplizerClass) {
|
||||
assert isComponentTuplizerImplementor( tuplizerClass )
|
||||
: "Specified tuplizer class [" + tuplizerClass.getName() + "] does not implement " + ComponentTuplizer.class.getName();
|
||||
assert hasProperConstructor( tuplizerClass )
|
||||
: "Specified tuplizer class [" + tuplizerClass.getName() + "] is not properly instantiatable";
|
||||
|
||||
defaultImplClassByMode.put( entityMode, tuplizerClass );
|
||||
defaultImplClassByMode.put( representationMode, tuplizerClass );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -77,7 +77,6 @@ public class ComponentTuplizerFactory implements Serializable {
|
|||
* @throws HibernateException If class name cannot be resolved to a class reference, or if the
|
||||
* {@link Constructor#newInstance} call fails.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public ComponentTuplizer constructTuplizer(String tuplizerClassName, Component metadata) {
|
||||
try {
|
||||
Class<? extends ComponentTuplizer> tuplizerClass = classLoaderAccess.classForName( tuplizerClassName );
|
||||
|
@ -121,7 +120,7 @@ public class ComponentTuplizerFactory implements Serializable {
|
|||
/**
|
||||
* Construct am instance of the default tuplizer for the given entity-mode.
|
||||
*
|
||||
* @param entityMode The entity mode for which to build a default tuplizer.
|
||||
* @param representationMode The entity mode for which to build a default tuplizer.
|
||||
* @param metadata The metadata for the component.
|
||||
*
|
||||
* @return The instantiated tuplizer
|
||||
|
@ -129,10 +128,10 @@ public class ComponentTuplizerFactory implements Serializable {
|
|||
* @throws HibernateException If no default tuplizer found for that entity-mode; may be re-thrown from
|
||||
* {@link #constructTuplizer} too.
|
||||
*/
|
||||
public ComponentTuplizer constructDefaultTuplizer(EntityMode entityMode, Component metadata) {
|
||||
Class<? extends ComponentTuplizer> tuplizerClass = defaultImplClassByMode.get( entityMode );
|
||||
public ComponentTuplizer constructDefaultTuplizer(RepresentationMode representationMode, Component metadata) {
|
||||
Class<? extends ComponentTuplizer> tuplizerClass = defaultImplClassByMode.get( representationMode );
|
||||
if ( tuplizerClass == null ) {
|
||||
throw new HibernateException( "could not determine default tuplizer class to use [" + entityMode + "]" );
|
||||
throw new HibernateException( "could not determine default tuplizer class to use [" + representationMode + "]" );
|
||||
}
|
||||
|
||||
return constructTuplizer( tuplizerClass, metadata );
|
||||
|
@ -147,7 +146,6 @@ public class ComponentTuplizerFactory implements Serializable {
|
|||
return getProperConstructor( tuplizerClass ) != null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Constructor<? extends ComponentTuplizer> getProperConstructor(Class<? extends ComponentTuplizer> clazz) {
|
||||
Constructor<? extends ComponentTuplizer> constructor = null;
|
||||
try {
|
||||
|
@ -165,10 +163,10 @@ public class ComponentTuplizerFactory implements Serializable {
|
|||
return constructor;
|
||||
}
|
||||
|
||||
private static Map<EntityMode,Class<? extends ComponentTuplizer>> buildBaseMapping() {
|
||||
Map<EntityMode,Class<? extends ComponentTuplizer>> map = new ConcurrentHashMap<>();
|
||||
map.put( EntityMode.POJO, PojoComponentTuplizer.class );
|
||||
map.put( EntityMode.MAP, DynamicMapComponentTuplizer.class );
|
||||
private static Map<RepresentationMode,Class<? extends ComponentTuplizer>> buildBaseMapping() {
|
||||
Map<RepresentationMode,Class<? extends ComponentTuplizer>> map = new ConcurrentHashMap<>();
|
||||
map.put( RepresentationMode.POJO, PojoComponentTuplizer.class );
|
||||
map.put( RepresentationMode.MAP, DynamicMapComponentTuplizer.class );
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -217,7 +216,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
throw new HibernateException( "The class has no identifier property: " + getEntityName() );
|
||||
}
|
||||
else {
|
||||
id = mappedIdentifierValueMarshaller.getIdentifier( entity, getEntityMode(), session );
|
||||
id = mappedIdentifierValueMarshaller.getIdentifier( entity, session );
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -245,21 +244,21 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
||||
if ( entity != id ) {
|
||||
CompositeType copier = (CompositeType) entityMetamodel.getIdentifierProperty().getType();
|
||||
copier.setPropertyValues( entity, copier.getPropertyValues( id, getEntityMode() ), getEntityMode() );
|
||||
copier.setPropertyValues( entity, copier.getPropertyValues( id ) );
|
||||
}
|
||||
}
|
||||
else if ( idSetter != null ) {
|
||||
idSetter.set( entity, id, getFactory() );
|
||||
}
|
||||
else if ( identifierMapperType != null ) {
|
||||
mappedIdentifierValueMarshaller.setIdentifier( entity, id, getEntityMode(), session );
|
||||
mappedIdentifierValueMarshaller.setIdentifier( entity, id, session );
|
||||
}
|
||||
}
|
||||
|
||||
private static interface MappedIdentifierValueMarshaller {
|
||||
public Object getIdentifier(Object entity, EntityMode entityMode, SharedSessionContractImplementor session);
|
||||
private interface MappedIdentifierValueMarshaller {
|
||||
Object getIdentifier(Object entity, SharedSessionContractImplementor session);
|
||||
|
||||
public void setIdentifier(Object entity, Object id, EntityMode entityMode, SharedSessionContractImplementor session);
|
||||
void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session);
|
||||
}
|
||||
|
||||
private final MappedIdentifierValueMarshaller mappedIdentifierValueMarshaller;
|
||||
|
@ -314,19 +313,18 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getIdentifier(Object entity, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
Object id = mappedIdentifierType.instantiate( entityMode );
|
||||
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
||||
mappedIdentifierType.setPropertyValues( id, propertyValues, entityMode );
|
||||
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
Object id = mappedIdentifierType.instantiate();
|
||||
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity );
|
||||
mappedIdentifierType.setPropertyValues( id, propertyValues );
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Object id, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||
virtualIdComponent.setPropertyValues(
|
||||
entity,
|
||||
mappedIdentifierType.getPropertyValues( id, session ),
|
||||
entityMode
|
||||
mappedIdentifierType.getPropertyValues( id, session )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -353,9 +351,9 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object getIdentifier(Object entity, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
final Object id = mappedIdentifierType.instantiate( entityMode );
|
||||
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
||||
public Object getIdentifier(Object entity, SharedSessionContractImplementor session) {
|
||||
final Object id = mappedIdentifierType.instantiate();
|
||||
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity );
|
||||
final Type[] subTypes = virtualIdComponent.getSubtypes();
|
||||
final Type[] copierSubTypes = mappedIdentifierType.getSubtypes();
|
||||
final int length = subTypes.length;
|
||||
|
@ -381,13 +379,13 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
);
|
||||
}
|
||||
}
|
||||
mappedIdentifierType.setPropertyValues( id, propertyValues, entityMode );
|
||||
mappedIdentifierType.setPropertyValues( id, propertyValues );
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdentifier(Object entity, Object id, EntityMode entityMode, SharedSessionContractImplementor session) {
|
||||
final Object[] extractedValues = mappedIdentifierType.getPropertyValues( id, entityMode );
|
||||
public void setIdentifier(Object entity, Object id, SharedSessionContractImplementor session) {
|
||||
final Object[] extractedValues = mappedIdentifierType.getPropertyValues( id );
|
||||
final Object[] injectionValues = new Object[extractedValues.length];
|
||||
final PersistenceContext persistenceContext = session.getPersistenceContextInternal();
|
||||
final MetamodelImplementor metamodel = sessionFactory.getMetamodel();
|
||||
|
@ -424,7 +422,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
|||
injectionValues[i] = extractedValues[i];
|
||||
}
|
||||
}
|
||||
virtualIdComponent.setPropertyValues( entity, injectionValues, entityMode );
|
||||
virtualIdComponent.setPropertyValues( entity, injectionValues );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.tuple.entity;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
|
@ -16,6 +15,7 @@ import org.hibernate.internal.CoreLogging;
|
|||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.property.access.internal.PropertyAccessStrategyMapImpl;
|
||||
import org.hibernate.property.access.spi.Getter;
|
||||
import org.hibernate.property.access.spi.PropertyAccess;
|
||||
|
@ -39,8 +39,8 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getEntityMode() {
|
||||
return EntityMode.MAP;
|
||||
public RepresentationMode getEntityMode() {
|
||||
return RepresentationMode.MAP;
|
||||
}
|
||||
|
||||
private PropertyAccess buildPropertyAccess(Property mappedProperty) {
|
||||
|
|
|
@ -8,11 +8,11 @@ package org.hibernate.tuple.entity;
|
|||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.property.access.spi.Getter;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
import org.hibernate.tuple.Tuplizer;
|
||||
|
@ -37,7 +37,7 @@ public interface EntityTuplizer extends Tuplizer {
|
|||
*
|
||||
* @return The entity-mode
|
||||
*/
|
||||
EntityMode getEntityMode();
|
||||
RepresentationMode getEntityMode();
|
||||
|
||||
/**
|
||||
* Extract the identifier value from the given entity.
|
||||
|
|
|
@ -11,20 +11,20 @@ import java.lang.reflect.Constructor;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
/**
|
||||
* A registry allowing users to define the default {@link EntityTuplizer} class to use per {@link EntityMode}.
|
||||
* A registry allowing users to define the default {@link EntityTuplizer} class to use per {@link RepresentationMode}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityTuplizerFactory implements Serializable {
|
||||
public static final Class[] ENTITY_TUP_CTOR_SIG = new Class[] { EntityMetamodel.class, PersistentClass.class };
|
||||
|
||||
private Map<EntityMode,Class<? extends EntityTuplizer>> defaultImplClassByMode = buildBaseMapping();
|
||||
private Map<RepresentationMode,Class<? extends EntityTuplizer>> defaultImplClassByMode = buildBaseMapping();
|
||||
|
||||
/**
|
||||
* Method allowing registration of the tuplizer class to use as default for a particular entity-mode.
|
||||
|
@ -32,7 +32,7 @@ public class EntityTuplizerFactory implements Serializable {
|
|||
* @param entityMode The entity-mode for which to register the tuplizer class
|
||||
* @param tuplizerClass The class to use as the default tuplizer for the given entity-mode.
|
||||
*/
|
||||
public void registerDefaultTuplizerClass(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) {
|
||||
public void registerDefaultTuplizerClass(RepresentationMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) {
|
||||
assert isEntityTuplizerImplementor( tuplizerClass )
|
||||
: "Specified tuplizer class [" + tuplizerClass.getName() + "] does not implement " + EntityTuplizer.class.getName();
|
||||
// TODO: for now we need constructors for both PersistentClass and EntityBinding
|
||||
|
@ -92,30 +92,6 @@ public class EntityTuplizerFactory implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an instance of the default tuplizer for the given entity-mode.
|
||||
*
|
||||
* @param entityMode The entity mode for which to build a default tuplizer.
|
||||
* @param metamodel The entity metadata.
|
||||
* @param persistentClass The entity mapping info.
|
||||
*
|
||||
* @return The instantiated tuplizer
|
||||
*
|
||||
* @throws HibernateException If no default tuplizer found for that entity-mode; may be re-thrown from
|
||||
* {@link #constructTuplizer} too.
|
||||
*/
|
||||
public EntityTuplizer constructDefaultTuplizer(
|
||||
EntityMode entityMode,
|
||||
EntityMetamodel metamodel,
|
||||
PersistentClass persistentClass) {
|
||||
Class<? extends EntityTuplizer> tuplizerClass = defaultImplClassByMode.get( entityMode );
|
||||
if ( tuplizerClass == null ) {
|
||||
throw new HibernateException( "could not determine default tuplizer class to use [" + entityMode + "]" );
|
||||
}
|
||||
|
||||
return constructTuplizer( tuplizerClass, metamodel, persistentClass );
|
||||
}
|
||||
|
||||
private boolean isEntityTuplizerImplementor(Class tuplizerClass) {
|
||||
return ReflectHelper.implementsInterface( tuplizerClass, EntityTuplizer.class );
|
||||
}
|
||||
|
@ -144,10 +120,10 @@ public class EntityTuplizerFactory implements Serializable {
|
|||
return constructor;
|
||||
}
|
||||
|
||||
private static Map<EntityMode,Class<? extends EntityTuplizer>> buildBaseMapping() {
|
||||
Map<EntityMode,Class<? extends EntityTuplizer>> map = new ConcurrentHashMap<>();
|
||||
map.put( EntityMode.POJO, PojoEntityTuplizer.class );
|
||||
map.put( EntityMode.MAP, DynamicMapEntityTuplizer.class );
|
||||
private static Map<RepresentationMode,Class<? extends EntityTuplizer>> buildBaseMapping() {
|
||||
Map<RepresentationMode,Class<? extends EntityTuplizer>> map = new ConcurrentHashMap<>();
|
||||
map.put( RepresentationMode.POJO, PojoEntityTuplizer.class );
|
||||
map.put( RepresentationMode.MAP, DynamicMapEntityTuplizer.class );
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import java.lang.reflect.Method;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor;
|
||||
|
@ -28,6 +27,7 @@ import org.hibernate.internal.CoreLogging;
|
|||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.property.access.spi.Getter;
|
||||
import org.hibernate.property.access.spi.Setter;
|
||||
import org.hibernate.proxy.ProxyFactory;
|
||||
|
@ -150,8 +150,8 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getEntityMode() {
|
||||
return EntityMode.POJO;
|
||||
public RepresentationMode getEntityMode() {
|
||||
return RepresentationMode.POJO;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.EntityNameResolver;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.Hibernate;
|
||||
|
@ -96,7 +95,7 @@ public class AnyType extends AbstractType implements CompositeType, AssociationT
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object[] getPropertyValues(Object component, EntityMode entityMode) {
|
||||
public Object[] getPropertyValues(Object component) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
@ -381,7 +380,7 @@ public class AnyType extends AbstractType implements CompositeType, AssociationT
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValues(Object component, Object[] values, EntityMode entityMode) {
|
||||
public void setPropertyValues(Object component, Object[] values) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import java.sql.SQLException;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -28,12 +27,15 @@ import org.hibernate.engine.spi.SessionFactoryImplementor;
|
|||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
import org.hibernate.tuple.ValueGeneration;
|
||||
import org.hibernate.tuple.component.ComponentMetamodel;
|
||||
import org.hibernate.tuple.component.ComponentTuplizer;
|
||||
import org.hibernate.type.descriptor.java.JavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.spi.CompositeTypeImplementor;
|
||||
import org.hibernate.type.spi.TypeConfiguration;
|
||||
|
||||
/**
|
||||
|
@ -41,7 +43,7 @@ import org.hibernate.type.spi.TypeConfiguration;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class ComponentType extends AbstractType implements CompositeType, ProcedureParameterExtractionAware {
|
||||
public class ComponentType extends AbstractType implements CompositeTypeImplementor, ProcedureParameterExtractionAware {
|
||||
|
||||
private final TypeConfiguration typeConfiguration;
|
||||
private final String[] propertyNames;
|
||||
|
@ -56,8 +58,8 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
private boolean hasNotNullProperty;
|
||||
private final boolean createEmptyCompositesEnabled;
|
||||
|
||||
protected final EntityMode entityMode;
|
||||
protected final ComponentTuplizer componentTuplizer;
|
||||
private EmbeddableValuedModelPart mappingModelPart;
|
||||
|
||||
public ComponentType(TypeConfiguration typeConfiguration, ComponentMetamodel metamodel, int[] originalPropertyOrder) {
|
||||
this.typeConfiguration = typeConfiguration;
|
||||
|
@ -85,7 +87,6 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
this.propertyValueGenerationStrategies[i] = prop.getValueGenerationStrategy();
|
||||
}
|
||||
|
||||
this.entityMode = metamodel.getEntityMode();
|
||||
this.componentTuplizer = metamodel.getComponentTuplizer();
|
||||
this.createEmptyCompositesEnabled = metamodel.isCreateEmptyCompositesEnabled();
|
||||
}
|
||||
|
@ -94,10 +95,6 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
return isKey;
|
||||
}
|
||||
|
||||
public EntityMode getEntityMode() {
|
||||
return entityMode;
|
||||
}
|
||||
|
||||
public ComponentTuplizer getComponentTuplizer() {
|
||||
return componentTuplizer;
|
||||
}
|
||||
|
@ -167,8 +164,8 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
return true;
|
||||
}
|
||||
// null value and empty component are considered equivalent
|
||||
Object[] xvalues = getPropertyValues( x, entityMode );
|
||||
Object[] yvalues = getPropertyValues( y, entityMode );
|
||||
Object[] xvalues = getPropertyValues( x );
|
||||
Object[] yvalues = getPropertyValues( y );
|
||||
for ( int i = 0; i < propertySpan; i++ ) {
|
||||
if ( !propertyTypes[i].isSame( xvalues[i], yvalues[i] ) ) {
|
||||
return false;
|
||||
|
@ -326,7 +323,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
public void nullSafeSet(PreparedStatement st, Object value, int begin, SharedSessionContractImplementor session)
|
||||
throws HibernateException, SQLException {
|
||||
|
||||
Object[] subvalues = nullSafeGetValues( value, entityMode );
|
||||
Object[] subvalues = nullSafeGetValues( value );
|
||||
|
||||
for ( int i = 0; i < propertySpan; i++ ) {
|
||||
propertyTypes[i].nullSafeSet( st, subvalues[i], begin, session );
|
||||
|
@ -343,7 +340,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
SharedSessionContractImplementor session)
|
||||
throws HibernateException, SQLException {
|
||||
|
||||
Object[] subvalues = nullSafeGetValues( value, entityMode );
|
||||
Object[] subvalues = nullSafeGetValues( value );
|
||||
|
||||
int loc = 0;
|
||||
for ( int i = 0; i < propertySpan; i++ ) {
|
||||
|
@ -368,12 +365,12 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
}
|
||||
}
|
||||
|
||||
private Object[] nullSafeGetValues(Object value, EntityMode entityMode) throws HibernateException {
|
||||
private Object[] nullSafeGetValues(Object value) {
|
||||
if ( value == null ) {
|
||||
return new Object[propertySpan];
|
||||
}
|
||||
else {
|
||||
return getPropertyValues( value, entityMode );
|
||||
return getPropertyValues( value );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,11 +380,6 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
return getPropertyValue( component, i );
|
||||
}
|
||||
|
||||
public Object getPropertyValue(Object component, int i, EntityMode entityMode)
|
||||
throws HibernateException {
|
||||
return getPropertyValue( component, i );
|
||||
}
|
||||
|
||||
public Object getPropertyValue(Object component, int i)
|
||||
throws HibernateException {
|
||||
if (component == null) {
|
||||
|
@ -406,14 +398,12 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object[] getPropertyValues(Object component, SharedSessionContractImplementor session)
|
||||
throws HibernateException {
|
||||
return getPropertyValues( component, entityMode );
|
||||
public Object[] getPropertyValues(Object component, SharedSessionContractImplementor session) {
|
||||
return getPropertyValues( component );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getPropertyValues(Object component, EntityMode entityMode)
|
||||
throws HibernateException {
|
||||
public Object[] getPropertyValues(Object component) {
|
||||
if (component == null) {
|
||||
component = new Object[propertySpan];
|
||||
}
|
||||
|
@ -430,7 +420,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setPropertyValues(Object component, Object[] values, EntityMode entityMode)
|
||||
public void setPropertyValues(Object component, Object[] values)
|
||||
throws HibernateException {
|
||||
componentTuplizer.setPropertyValues( component, values );
|
||||
}
|
||||
|
@ -456,11 +446,8 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
return "null";
|
||||
}
|
||||
|
||||
if ( entityMode == null ) {
|
||||
throw new ClassCastException( value.getClass().getName() );
|
||||
}
|
||||
Map<String, String> result = new HashMap<>();
|
||||
Object[] values = getPropertyValues( value, entityMode );
|
||||
Object[] values = getPropertyValues( value );
|
||||
for ( int i = 0; i < propertyTypes.length; i++ ) {
|
||||
if ( values[i] == LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
|
||||
result.put( propertyNames[i], "<uninitialized>" );
|
||||
|
@ -484,13 +471,13 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
return null;
|
||||
}
|
||||
|
||||
Object[] values = getPropertyValues( component, entityMode );
|
||||
Object[] values = getPropertyValues( component );
|
||||
for ( int i = 0; i < propertySpan; i++ ) {
|
||||
values[i] = propertyTypes[i].deepCopy( values[i], factory );
|
||||
}
|
||||
|
||||
Object result = instantiate( entityMode );
|
||||
setPropertyValues( result, values, entityMode );
|
||||
Object result = instantiate();
|
||||
setPropertyValues( result, values );
|
||||
|
||||
//not absolutely necessary, but helps for some
|
||||
//equals()/hashCode() implementations
|
||||
|
@ -520,15 +507,15 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
: target;
|
||||
|
||||
Object[] values = TypeHelper.replace(
|
||||
getPropertyValues( original, entityMode ),
|
||||
getPropertyValues( result, entityMode ),
|
||||
getPropertyValues( original ),
|
||||
getPropertyValues( result ),
|
||||
propertyTypes,
|
||||
session,
|
||||
owner,
|
||||
copyCache
|
||||
);
|
||||
|
||||
setPropertyValues( result, values, entityMode );
|
||||
setPropertyValues( result, values );
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -552,8 +539,8 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
target;
|
||||
|
||||
Object[] values = TypeHelper.replace(
|
||||
getPropertyValues( original, entityMode ),
|
||||
getPropertyValues( result, entityMode ),
|
||||
getPropertyValues( original ),
|
||||
getPropertyValues( result ),
|
||||
propertyTypes,
|
||||
session,
|
||||
owner,
|
||||
|
@ -561,21 +548,21 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
foreignKeyDirection
|
||||
);
|
||||
|
||||
setPropertyValues( result, values, entityMode );
|
||||
setPropertyValues( result, values );
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method does not populate the component parent
|
||||
*/
|
||||
public Object instantiate(EntityMode entityMode) throws HibernateException {
|
||||
public Object instantiate() {
|
||||
return componentTuplizer.instantiate();
|
||||
}
|
||||
|
||||
public Object instantiate(Object parent, SharedSessionContractImplementor session)
|
||||
throws HibernateException {
|
||||
|
||||
Object result = instantiate( entityMode );
|
||||
Object result = instantiate();
|
||||
|
||||
if ( componentTuplizer.hasParentProperty() && parent != null ) {
|
||||
componentTuplizer.setParent(
|
||||
|
@ -606,7 +593,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
return null;
|
||||
}
|
||||
else {
|
||||
Object[] values = getPropertyValues( value, entityMode );
|
||||
Object[] values = getPropertyValues( value );
|
||||
for ( int i = 0; i < propertyTypes.length; i++ ) {
|
||||
values[i] = propertyTypes[i].disassemble( values[i], session, owner );
|
||||
}
|
||||
|
@ -628,7 +615,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
assembled[i] = propertyTypes[i].assemble( (Serializable) values[i], session, owner );
|
||||
}
|
||||
Object result = instantiate( owner, session );
|
||||
setPropertyValues( result, assembled, entityMode );
|
||||
setPropertyValues( result, assembled );
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -672,7 +659,7 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
if ( value == null ) {
|
||||
return result;
|
||||
}
|
||||
Object[] values = getPropertyValues( value, EntityMode.POJO ); //TODO!!!!!!!
|
||||
Object[] values = getPropertyValues( value ); //TODO!!!!!!!
|
||||
int loc = 0;
|
||||
for ( int i = 0; i < propertyTypes.length; i++ ) {
|
||||
boolean[] propertyNullness = propertyTypes[i].toColumnNullness( values[i], mapping );
|
||||
|
@ -820,4 +807,14 @@ public class ComponentType extends AbstractType implements CompositeType, Proced
|
|||
public Class getJavaType() {
|
||||
return getReturnedClass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectMappingModelPart(EmbeddableValuedModelPart part, MappingModelCreationProcess process) {
|
||||
this.mappingModelPart = part;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmbeddableValuedModelPart getMappingModelPart() {
|
||||
return mappingModelPart;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.type;
|
|||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.CascadeStyle;
|
||||
|
@ -63,13 +62,11 @@ public interface CompositeType extends Type {
|
|||
* An optional operation
|
||||
*
|
||||
* @param component The component instance
|
||||
* @param entityMode The entity mode
|
||||
*
|
||||
* @return The property values
|
||||
*
|
||||
* @throws HibernateException Indicates a problem access the property values.
|
||||
*/
|
||||
Object[] getPropertyValues(Object component, EntityMode entityMode) throws HibernateException;
|
||||
Object[] getPropertyValues(Object component) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Extract a particular component property value indicated by index.
|
||||
|
@ -91,11 +88,10 @@ public interface CompositeType extends Type {
|
|||
*
|
||||
* @param component The component instance
|
||||
* @param values The values to inject
|
||||
* @param entityMode The entity mode
|
||||
*
|
||||
* @throws HibernateException Indicates an issue performing the injection
|
||||
*/
|
||||
void setPropertyValues(Object component, Object[] values, EntityMode entityMode) throws HibernateException;
|
||||
void setPropertyValues(Object component, Object[] values) throws HibernateException;
|
||||
|
||||
/**
|
||||
* Retrieve the cascade style of the indicated component property.
|
||||
|
|
|
@ -689,7 +689,6 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
|||
uniqueKeyPropertyName,
|
||||
key,
|
||||
getIdentifierOrUniqueKeyType( factory ),
|
||||
persister.getEntityMode(),
|
||||
session.getFactory()
|
||||
);
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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.type.spi;
|
||||
|
||||
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
||||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface CompositeTypeImplementor extends CompositeType {
|
||||
void injectMappingModelPart(EmbeddableValuedModelPart part, MappingModelCreationProcess process);
|
||||
EmbeddableValuedModelPart getMappingModelPart();
|
||||
}
|
|
@ -42,9 +42,9 @@
|
|||
</jaxb:bindings>
|
||||
|
||||
<jaxb:bindings node="//xsd:simpleType[@name='EntityModeEnum']">
|
||||
<jaxb:javaType name="org.hibernate.EntityMode"
|
||||
parseMethod="org.hibernate.boot.jaxb.hbm.internal.EntityModeConverter.fromXml"
|
||||
printMethod="org.hibernate.boot.jaxb.hbm.internal.EntityModeConverter.toXml" />
|
||||
<jaxb:javaType name="org.hibernate.metamodel.RepresentationMode"
|
||||
parseMethod="org.hibernate.boot.jaxb.hbm.internal.RepresentationModeConverter.fromXml"
|
||||
printMethod="org.hibernate.boot.jaxb.hbm.internal.RepresentationModeConverter.toXml" />
|
||||
</jaxb:bindings>
|
||||
|
||||
<jaxb:bindings node="//xsd:simpleType[@name='FlushModeEnum']">
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
*/
|
||||
package org.hibernate.orm.test.boot.jaxb.hbm.internal;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmHibernateMapping;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmRootEntityType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmSimpleIdType;
|
||||
import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmTuplizerType;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.tuple.entity.DynamicMapEntityTuplizer;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
|
@ -19,7 +19,7 @@ import org.junit.Test;
|
|||
/**
|
||||
* @author Jean-François Boeuf
|
||||
*/
|
||||
public class EntityModeConverterTest extends BaseUnitTestCase {
|
||||
public class RepresentationModeConverterTest extends BaseUnitTestCase {
|
||||
|
||||
@Test
|
||||
public void testMashallNullEntityMode() throws Exception {
|
||||
|
@ -38,7 +38,7 @@ public class EntityModeConverterTest extends BaseUnitTestCase {
|
|||
JaxbHbmTuplizerType tuplizer = new JaxbHbmTuplizerType();
|
||||
tuplizer.setClazz( DynamicMapEntityTuplizer.class.getCanonicalName() );
|
||||
if ( includeEntityMode ) {
|
||||
tuplizer.setEntityMode( EntityMode.MAP );
|
||||
tuplizer.setEntityMode( RepresentationMode.MAP );
|
||||
}
|
||||
clazz.getTuplizer().add( tuplizer );
|
||||
JaxbHbmSimpleIdType id = new JaxbHbmSimpleIdType();
|
|
@ -13,7 +13,6 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Filter;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
|
@ -96,11 +95,6 @@ public class GoofyPersisterClassProvider implements PersisterClassResolver {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getEntityMode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityTuplizer getEntityTuplizer() {
|
||||
return null;
|
||||
|
|
|
@ -6,24 +6,22 @@
|
|||
*/
|
||||
package org.hibernate.orm.test.component.proxy;
|
||||
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.boot.Metadata;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
|
||||
import org.hibernate.orm.test.annotations.basic.CollectionAsBasicTest;
|
||||
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.type.ComponentType;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author Guillaume Smet
|
||||
* @author Oliver Libutzki
|
||||
|
@ -67,10 +65,10 @@ public class ComponentBasicProxyTest extends BaseEntityManagerFunctionalTestCase
|
|||
PersistentClass persistentClass = metadata.getEntityBinding( Person.class.getName() );
|
||||
|
||||
ComponentType componentType1 = (ComponentType) persistentClass.getIdentifierMapper().getType();
|
||||
Object instance1 = componentType1.instantiate( EntityMode.POJO );
|
||||
Object instance1 = componentType1.instantiate();
|
||||
|
||||
ComponentType componentType2 = (ComponentType) persistentClass.getIdentifierMapper().getType();
|
||||
Object instance2 = componentType2.instantiate( EntityMode.POJO );
|
||||
Object instance2 = componentType2.instantiate();
|
||||
|
||||
assertEquals( instance1.getClass(), instance2.getClass() );
|
||||
}
|
||||
|
|
|
@ -5,21 +5,20 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.orm.test.entitymode.map.basic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
@ -42,7 +41,6 @@ public class DynamicClassTest extends BaseCoreFunctionalTestCase {
|
|||
|
||||
@Override
|
||||
public void configure(Configuration cfg) {
|
||||
cfg.setProperty(Environment.DEFAULT_ENTITY_MODE, EntityMode.MAP.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -16,7 +16,6 @@ import java.util.function.Consumer;
|
|||
import jakarta.persistence.EntityManagerFactory;
|
||||
import jakarta.persistence.PersistenceException;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
|
@ -118,11 +117,6 @@ public class PersisterClassProviderTest {
|
|||
throw new GoofyException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getEntityMode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityTuplizer getEntityTuplizer() {
|
||||
return null;
|
||||
|
|
|
@ -15,7 +15,6 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
|
@ -29,16 +28,12 @@ import org.hibernate.cache.spi.entry.StandardCacheEntryImpl;
|
|||
import org.hibernate.cache.spi.entry.UnstructuredCacheEntry;
|
||||
import org.hibernate.cfg.NotYetImplementedException;
|
||||
import org.hibernate.engine.internal.MutableEntityEntryFactory;
|
||||
import org.hibernate.engine.internal.TwoPhaseLoad;
|
||||
import org.hibernate.engine.spi.CascadeStyle;
|
||||
import org.hibernate.engine.spi.EntityEntryFactory;
|
||||
import org.hibernate.engine.spi.LoadQueryInfluencers;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.engine.spi.ValueInclusion;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.event.spi.PostLoadEvent;
|
||||
import org.hibernate.event.spi.PreLoadEvent;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.id.UUIDHexGenerator;
|
||||
import org.hibernate.internal.FilterAliasGenerator;
|
||||
|
@ -714,11 +709,6 @@ public class CustomPersister implements EntityPersister {
|
|||
return entityMetamodel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityMode getEntityMode() {
|
||||
return EntityMode.POJO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityTuplizer getEntityTuplizer() {
|
||||
return null;
|
||||
|
|
|
@ -36,7 +36,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|||
@ServiceRegistry(
|
||||
settings = {
|
||||
@Setting(name = Environment.USE_SECOND_LEVEL_CACHE, value = "false"),
|
||||
@Setting(name = Environment.DEFAULT_ENTITY_MODE, value = "dynamic-map"),
|
||||
}
|
||||
)
|
||||
public class DynamicMapOneToOneTest {
|
||||
|
|
|
@ -39,7 +39,6 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||
@SessionFactory
|
||||
@ServiceRegistry(settings = {
|
||||
@Setting( name = AvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS, value = "true" ),
|
||||
@Setting( name = AvailableSettings.DEFAULT_ENTITY_MODE, value = "dynamic-map" )
|
||||
})
|
||||
public class MapProxySerializationTest {
|
||||
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.test.dynamicentity.interceptor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
import org.hibernate.test.dynamicentity.Company;
|
||||
import org.hibernate.test.dynamicentity.Customer;
|
||||
import org.hibernate.test.dynamicentity.ProxyHelper;
|
||||
|
@ -49,8 +51,8 @@ public class ProxyInterceptor extends EmptyInterceptor {
|
|||
* @param id The identifier value for the given entity.
|
||||
* @return The instantiated instance.
|
||||
*/
|
||||
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) {
|
||||
if ( entityMode == EntityMode.POJO ) {
|
||||
public Object instantiate(String entityName, RepresentationMode entityMode, Serializable id) {
|
||||
if ( entityMode == RepresentationMode.POJO ) {
|
||||
if ( Customer.class.getName().equals( entityName ) ) {
|
||||
return ProxyHelper.newCustomerProxy( id );
|
||||
}
|
||||
|
|
|
@ -8,18 +8,18 @@ package org.hibernate.test.dynamicentity.tuplizer2;
|
|||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.hibernate.test.dynamicentity.Address;
|
||||
import org.hibernate.test.dynamicentity.Company;
|
||||
import org.hibernate.test.dynamicentity.Customer;
|
||||
import org.hibernate.test.dynamicentity.Person;
|
||||
import org.hibernate.test.dynamicentity.ProxyHelper;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
@ -43,7 +43,7 @@ public class ImprovedTuplizerDynamicEntityTest extends BaseCoreFunctionalTestCas
|
|||
|
||||
public void configure(Configuration cfg) {
|
||||
super.configure( cfg );
|
||||
cfg.getEntityTuplizerFactory().registerDefaultTuplizerClass( EntityMode.POJO, MyEntityTuplizer.class );
|
||||
cfg.getEntityTuplizerFactory().registerDefaultTuplizerClass( RepresentationMode.POJO, MyEntityTuplizer.class );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -9,11 +9,10 @@
|
|||
* @author Gail Badner
|
||||
*/
|
||||
package org.hibernate.test.interceptor;
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.hibernate.CallbackException;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
|
||||
public class InstantiateInterceptor extends EmptyInterceptor {
|
||||
private String injectedString;
|
||||
|
@ -22,7 +21,8 @@ public class InstantiateInterceptor extends EmptyInterceptor {
|
|||
this.injectedString = injectedString;
|
||||
}
|
||||
|
||||
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
|
||||
@Override
|
||||
public Object instantiate(String entityName, RepresentationMode entityMode, Object id) throws CallbackException {
|
||||
if ( ! "org.hibernate.test.interceptor.User".equals( entityName ) ) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -7,14 +7,15 @@
|
|||
|
||||
//$Id: DocumentInterceptor.java 7860 2005-08-11 21:58:23Z oneovthafew $
|
||||
package org.hibernate.test.interfaceproxy;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Calendar;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.CallbackException;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -73,7 +74,7 @@ public class DocumentInterceptor implements Interceptor {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
|
||||
public Object instantiate(String entityName, RepresentationMode entityMode, Object id) throws CallbackException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ import java.util.Calendar;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.CallbackException;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -85,7 +85,7 @@ public class DocumentInterceptor implements Interceptor {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Object instantiate(String entityName, EntityMode entityMode, Serializable id) throws CallbackException {
|
||||
public Object instantiate(String entityName, RepresentationMode entityMode, Object id) throws CallbackException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,8 @@ package org.hibernate.test.tm;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import jakarta.transaction.Transaction;
|
||||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.ScrollableResults;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
|
@ -27,6 +25,8 @@ import org.hibernate.testing.jta.TestingJtaPlatformImpl;
|
|||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import jakarta.transaction.Transaction;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
@ -53,7 +53,6 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
settings.put( AvailableSettings.GENERATE_STATISTICS, "true" );
|
||||
settings.put( AvailableSettings.USE_QUERY_CACHE, "true" );
|
||||
settings.put( AvailableSettings.CACHE_REGION_PREFIX, "" );
|
||||
settings.put( AvailableSettings.DEFAULT_ENTITY_MODE, EntityMode.MAP.toString() );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue