HHH-15837 - Cleanup the tuple package
This commit is contained in:
parent
33c00d78c3
commit
78c3edf695
|
@ -23,7 +23,8 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|||
* of a deprecation lifecycle.
|
||||
*
|
||||
* @apiNote Intended for use at development-time for developers to better understand
|
||||
* the lifecycle of the annotated element.
|
||||
* the lifecycle of the annotated element. Also, useful for "deprecating" a package
|
||||
* as the Java compiler does not like `@Deprecated` on packages.
|
||||
*
|
||||
* @see Deprecated#forRemoval()
|
||||
*
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
* 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>.
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||
*/
|
||||
package org.hibernate.tuple.entity;
|
||||
package org.hibernate.bytecode.internal;
|
||||
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.BytecodeLazyAttributeInterceptor;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor;
|
||||
|
@ -17,6 +17,9 @@ import org.hibernate.engine.spi.PersistentAttributeInterceptor;
|
|||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
|
||||
/**
|
||||
* BytecodeEnhancementMetadata implementation for non-POJO models, mainly
|
||||
* {@link org.hibernate.metamodel.RepresentationMode#MAP}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class BytecodeEnhancementMetadataNonPojoImpl implements BytecodeEnhancementMetadata {
|
|
@ -2,9 +2,9 @@
|
|||
* 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>.
|
||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
||||
*/
|
||||
package org.hibernate.tuple.entity;
|
||||
package org.hibernate.bytecode.internal;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
|
@ -32,6 +32,8 @@ import static org.hibernate.engine.internal.ManagedTypeHelper.isPersistentAttrib
|
|||
import static org.hibernate.engine.internal.ManagedTypeHelper.processIfSelfDirtinessTracker;
|
||||
|
||||
/**
|
||||
* BytecodeEnhancementMetadata implementation for {@link org.hibernate.metamodel.RepresentationMode#POJO POJO} models
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public final class BytecodeEnhancementMetadataPojoImpl implements BytecodeEnhancementMetadata {
|
|
@ -68,6 +68,7 @@ import org.hibernate.classic.Lifecycle;
|
|||
import org.hibernate.collection.spi.PersistentCollection;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.dialect.lock.LockingStrategy;
|
||||
import org.hibernate.engine.FetchStyle;
|
||||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.engine.OptimisticLockStyle;
|
||||
import org.hibernate.engine.internal.CacheHelper;
|
||||
|
@ -95,6 +96,8 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.event.spi.LoadEvent;
|
||||
import org.hibernate.generator.EventType;
|
||||
import org.hibernate.generator.Generator;
|
||||
import org.hibernate.generator.InDatabaseGenerator;
|
||||
import org.hibernate.generator.InMemoryGenerator;
|
||||
import org.hibernate.generator.internal.VersionGeneration;
|
||||
import org.hibernate.id.Assigned;
|
||||
|
@ -193,7 +196,6 @@ import org.hibernate.metamodel.spi.EntityInstantiator;
|
|||
import org.hibernate.metamodel.spi.EntityRepresentationStrategy;
|
||||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.collection.QueryableCollection;
|
||||
import org.hibernate.persister.entity.mutation.DeleteCoordinator;
|
||||
import org.hibernate.persister.entity.mutation.EntityMutationTarget;
|
||||
import org.hibernate.persister.entity.mutation.EntityTableMapping;
|
||||
|
@ -262,10 +264,7 @@ import org.hibernate.sql.results.graph.embeddable.EmbeddableResultGraphNode;
|
|||
import org.hibernate.sql.results.graph.entity.internal.EntityResultImpl;
|
||||
import org.hibernate.sql.results.internal.SqlSelectionImpl;
|
||||
import org.hibernate.stat.spi.StatisticsImplementor;
|
||||
import org.hibernate.generator.Generator;
|
||||
import org.hibernate.generator.InDatabaseGenerator;
|
||||
import org.hibernate.tuple.NonIdentifierAttribute;
|
||||
import org.hibernate.tuple.entity.EntityBasedAssociationAttribute;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
import org.hibernate.type.AnyType;
|
||||
import org.hibernate.type.AssociationType;
|
||||
|
@ -3484,19 +3483,17 @@ public abstract class AbstractEntityPersister
|
|||
if ( filterHelper.isAffectedBy( loadQueryInfluencers.getEnabledFilters() ) ) {
|
||||
return true;
|
||||
}
|
||||
// we still need to verify collection fields to be eagerly loaded by 'join'
|
||||
for ( NonIdentifierAttribute attribute : entityMetamodel.getProperties() ) {
|
||||
if ( attribute instanceof EntityBasedAssociationAttribute ) {
|
||||
final AssociationType associationType = ( (EntityBasedAssociationAttribute) attribute ).getType();
|
||||
if ( associationType instanceof CollectionType ) {
|
||||
final Joinable joinable = associationType.getAssociatedJoinable( getFactory() );
|
||||
if ( joinable.isCollection() ) {
|
||||
final QueryableCollection collectionPersister = (QueryableCollection) joinable;
|
||||
if ( collectionPersister.getFetchMode() == FetchMode.JOIN
|
||||
&& collectionPersister.isAffectedByEnabledFilters( loadQueryInfluencers ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// we still need to verify collection fields to be eagerly loaded by join
|
||||
final List<AttributeMapping> attributeMappings = getAttributeMappings();
|
||||
for ( int i = 0; i < attributeMappings.size(); i++ ) {
|
||||
final AttributeMapping attributeMapping = attributeMappings.get( i );
|
||||
if ( attributeMapping instanceof PluralAttributeMapping ) {
|
||||
final PluralAttributeMapping pluralAttributeMapping = (PluralAttributeMapping) attributeMapping;
|
||||
if ( pluralAttributeMapping.getMappedFetchOptions().getTiming() == FetchTiming.IMMEDIATE
|
||||
&& pluralAttributeMapping.getMappedFetchOptions().getStyle() == FetchStyle.JOIN
|
||||
&& pluralAttributeMapping.getCollectionDescriptor().isAffectedByEnabledFilters( loadQueryInfluencers ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3583,7 +3580,8 @@ public abstract class AbstractEntityPersister
|
|||
private void logDirtyProperties(int[] props) {
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
for ( int prop : props ) {
|
||||
String propertyName = entityMetamodel.getProperties()[prop].getName();
|
||||
final AttributeMapping attributeMapping = getAttributeMapping( prop );
|
||||
final String propertyName = attributeMapping.getAttributeName();
|
||||
LOG.trace(StringHelper.qualify(getEntityName(), propertyName) + " is dirty");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,9 @@ package org.hibernate.tuple;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract class AbstractAttribute implements Attribute {
|
||||
private final String attributeName;
|
||||
private final Type attributeType;
|
||||
|
|
|
@ -13,8 +13,9 @@ import org.hibernate.persister.walking.spi.AttributeSource;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract class AbstractNonIdentifierAttribute extends AbstractAttribute implements NonIdentifierAttribute {
|
||||
private final AttributeSource source;
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
|
|
|
@ -9,10 +9,9 @@ package org.hibernate.tuple;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Contract for attributes
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @deprecated Replaced by {@link org.hibernate.metamodel.mapping.AttributeMapping}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public interface Attribute {
|
||||
String getName();
|
||||
Type getType();
|
||||
|
|
|
@ -10,8 +10,10 @@ import org.hibernate.FetchMode;
|
|||
import org.hibernate.engine.spi.CascadeStyle;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement, though see {@link org.hibernate.metamodel.mapping.AttributeMapping}
|
||||
* and {@link org.hibernate.metamodel.mapping.AttributeMetadata}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class BaselineAttributeInformation {
|
||||
private final boolean lazy;
|
||||
private final boolean insertable;
|
||||
|
|
|
@ -10,8 +10,9 @@ import org.hibernate.generator.Generator;
|
|||
import org.hibernate.id.IdentifierGenerator;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement; see {@link org.hibernate.metamodel.mapping.EntityIdentifierMapping}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public interface IdentifierAttribute extends Attribute {
|
||||
boolean isVirtual();
|
||||
|
||||
|
|
|
@ -11,11 +11,9 @@ import org.hibernate.id.IdentifierGenerator;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Represents a defined entity identifier property within the Hibernate
|
||||
* runtime-metamodel.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement; see {@link org.hibernate.metamodel.mapping.EntityIdentifierMapping}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class IdentifierProperty extends AbstractAttribute implements IdentifierAttribute {
|
||||
|
||||
private final boolean virtual;
|
||||
|
|
|
@ -10,8 +10,9 @@ import org.hibernate.FetchMode;
|
|||
import org.hibernate.engine.spi.CascadeStyle;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public interface NonIdentifierAttribute extends Attribute {
|
||||
boolean isLazy();
|
||||
|
||||
|
|
|
@ -25,11 +25,9 @@ import org.hibernate.type.CompositeType;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Responsible for generation of runtime metamodel {@link Property} representations.
|
||||
* Makes distinction between identifier, version, and other (standard) properties.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public final class PropertyFactory {
|
||||
private PropertyFactory() {
|
||||
}
|
||||
|
@ -240,37 +238,4 @@ public final class PropertyFactory {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated See mainly {@link #buildEntityBasedAttribute}
|
||||
*/
|
||||
@Deprecated
|
||||
public static StandardProperty buildStandardProperty(Property property, boolean lazyAvailable) {
|
||||
final Type type = property.getValue().getType();
|
||||
|
||||
// we need to dirty check collections, since they can cause an owner
|
||||
// version number increment
|
||||
|
||||
// we need to dirty check many-to-ones with not-found="ignore" in order
|
||||
// to update the cache (not the database), since in this case a null
|
||||
// entity reference can lose information
|
||||
|
||||
boolean alwaysDirtyCheck = type.isAssociationType()
|
||||
&& ( (AssociationType) type ).isAlwaysDirtyChecked();
|
||||
|
||||
return new StandardProperty(
|
||||
property.getName(),
|
||||
type,
|
||||
// only called for embeddable sub-attributes which are never (yet) lazy
|
||||
//lazyAvailable && property.isLazy(),
|
||||
false,
|
||||
property.isInsertable(),
|
||||
property.isUpdateable(),
|
||||
property.isOptional(),
|
||||
alwaysDirtyCheck || property.isUpdateable(),
|
||||
property.isOptimisticLocked(),
|
||||
property.getCascadeStyle(),
|
||||
property.getValue().getFetchMode()
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,13 +11,9 @@ import org.hibernate.engine.spi.CascadeStyle;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Represents a non-identifier property within the Hibernate runtime-metamodel.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated Use one of the {@link Attribute}-based impls instead.
|
||||
* @deprecated Replaced by {@link org.hibernate.metamodel.mapping.AttributeMapping}
|
||||
*/
|
||||
@Deprecated
|
||||
@Deprecated(forRemoval = true)
|
||||
public class StandardProperty extends AbstractNonIdentifierAttribute implements NonIdentifierAttribute {
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,10 +14,9 @@ import org.hibernate.tuple.BaselineAttributeInformation;
|
|||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* A base class for a composite, non-identifier attribute.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract class AbstractCompositionAttribute
|
||||
extends AbstractNonIdentifierAttribute {
|
||||
|
||||
|
|
|
@ -13,8 +13,9 @@ import org.hibernate.tuple.BaselineAttributeInformation;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract class AbstractEntityBasedAttribute extends AbstractNonIdentifierAttribute {
|
||||
protected AbstractEntityBasedAttribute(
|
||||
EntityPersister source,
|
||||
|
|
|
@ -12,8 +12,9 @@ import org.hibernate.tuple.BaselineAttributeInformation;
|
|||
import org.hibernate.type.AssociationType;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
* @deprecated No direct replacement
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class EntityBasedAssociationAttribute
|
||||
extends AbstractEntityBasedAttribute {
|
||||
|
||||
|
|
|
@ -12,8 +12,9 @@ import org.hibernate.tuple.BaselineAttributeInformation;
|
|||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class EntityBasedBasicAttribute extends AbstractEntityBasedAttribute {
|
||||
public EntityBasedBasicAttribute(
|
||||
EntityPersister source,
|
||||
|
|
|
@ -13,8 +13,9 @@ import org.hibernate.tuple.component.AbstractCompositionAttribute;
|
|||
import org.hibernate.type.CompositeType;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
* @deprecated No direct replacement
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class EntityBasedCompositionAttribute
|
||||
extends AbstractCompositionAttribute {
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.EnhancementHelper;
|
||||
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataNonPojoImpl;
|
||||
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataPojoImpl;
|
||||
import org.hibernate.bytecode.spi.BytecodeEnhancementMetadata;
|
||||
import org.hibernate.cfg.NotYetImplementedException;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
@ -31,6 +33,9 @@ import org.hibernate.engine.spi.CascadeStyles;
|
|||
import org.hibernate.engine.spi.CascadingActions;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.generator.EventType;
|
||||
import org.hibernate.generator.Generator;
|
||||
import org.hibernate.generator.InDatabaseGenerator;
|
||||
import org.hibernate.generator.InMemoryGenerator;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
|
@ -44,10 +49,7 @@ import org.hibernate.metamodel.mapping.EntityMappingType;
|
|||
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.spi.PersisterCreationContext;
|
||||
import org.hibernate.generator.Generator;
|
||||
import org.hibernate.tuple.IdentifierProperty;
|
||||
import org.hibernate.generator.InDatabaseGenerator;
|
||||
import org.hibernate.generator.InMemoryGenerator;
|
||||
import org.hibernate.tuple.NonIdentifierAttribute;
|
||||
import org.hibernate.tuple.PropertyFactory;
|
||||
import org.hibernate.type.AssociationType;
|
||||
|
@ -803,6 +805,9 @@ public class EntityMetamodel implements Serializable {
|
|||
return propertyIndexes.get( propertyName );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public boolean hasCollections() {
|
||||
return hasCollections;
|
||||
}
|
||||
|
|
|
@ -7,17 +7,15 @@
|
|||
package org.hibernate.tuple.entity;
|
||||
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.VersionValue;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.tuple.AbstractNonIdentifierAttribute;
|
||||
import org.hibernate.tuple.BaselineAttributeInformation;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
* Represents a version property within the Hibernate runtime-metamodel.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
* @deprecated Replaced by {@link org.hibernate.metamodel.mapping.EntityVersionMapping}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class VersionProperty extends AbstractNonIdentifierAttribute {
|
||||
/**
|
||||
* Constructs VersionProperty instances.
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Most contracts here have been replaced by Hibernate's
|
||||
* {@linkplain org.hibernate.metamodel.mapping mapping-model}.
|
||||
*/
|
||||
@Remove
|
||||
package org.hibernate.tuple;
|
||||
|
||||
import org.hibernate.Remove;
|
|
@ -1,22 +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>.
|
||||
-->
|
||||
|
||||
<html>
|
||||
<head></head>
|
||||
<body>
|
||||
<p>
|
||||
This package defines a runtime metamodel for entities at
|
||||
the object level and abstracts the differences between
|
||||
the various entity modes. It is unaware of mappings to
|
||||
the database.
|
||||
</p>
|
||||
<p>
|
||||
(This package is still undergoing maturation and will change
|
||||
over the next few months.)
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
|
@ -26,6 +26,7 @@ import org.hibernate.engine.spi.CascadeStyle;
|
|||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.generator.Generator;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
|
@ -36,9 +37,6 @@ import org.hibernate.metamodel.spi.EmbeddableInstantiator;
|
|||
import org.hibernate.property.access.spi.PropertyAccess;
|
||||
import org.hibernate.query.sqm.SqmExpressible;
|
||||
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
||||
import org.hibernate.generator.Generator;
|
||||
import org.hibernate.tuple.PropertyFactory;
|
||||
import org.hibernate.tuple.StandardProperty;
|
||||
import org.hibernate.type.descriptor.jdbc.JdbcType;
|
||||
import org.hibernate.type.spi.CompositeTypeImplementor;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
|
@ -81,30 +79,26 @@ public class ComponentType extends AbstractType implements CompositeTypeImplemen
|
|||
|
||||
int i = 0;
|
||||
for ( Property property : component.getProperties() ) {
|
||||
// todo (6.0) : see if we really need to create these
|
||||
final StandardProperty prop = PropertyFactory.buildStandardProperty( property, false );
|
||||
this.propertyNames[i] = prop.getName();
|
||||
this.propertyTypes[i] = prop.getType();
|
||||
this.propertyNullability[i] = prop.isNullable();
|
||||
this.cascade[i] = prop.getCascadeStyle();
|
||||
this.joinedFetch[i] = prop.getFetchMode();
|
||||
if ( !prop.isNullable() ) {
|
||||
this.propertyNames[i] = property.getName();
|
||||
this.propertyTypes[i] = property.getValue().getType();
|
||||
this.propertyNullability[i] = property.isOptional();
|
||||
this.cascade[i] = property.getCascadeStyle();
|
||||
this.joinedFetch[i] = property.getValue().getFetchMode();
|
||||
if ( !propertyNullability[i] ) {
|
||||
hasNotNullProperty = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
if ( component.getTypeName() != null ) {
|
||||
//noinspection unchecked
|
||||
this.compositeUserType = (CompositeUserType<Object>) buildingContext.getBootstrapContext()
|
||||
final ManagedBeanRegistry beanRegistry = buildingContext.getBootstrapContext()
|
||||
.getServiceRegistry()
|
||||
.getService( ManagedBeanRegistry.class )
|
||||
.getBean(
|
||||
buildingContext.getBootstrapContext()
|
||||
.getClassLoaderAccess()
|
||||
.classForName( component.getTypeName() )
|
||||
)
|
||||
.getBeanInstance();
|
||||
.getService( ManagedBeanRegistry.class );
|
||||
final Class<Object> customTypeClass = buildingContext.getBootstrapContext()
|
||||
.getClassLoaderAccess()
|
||||
.classForName( component.getTypeName() );
|
||||
//noinspection unchecked
|
||||
this.compositeUserType = (CompositeUserType<Object>) beanRegistry.getBean( customTypeClass ).getBeanInstance();
|
||||
}
|
||||
else {
|
||||
this.compositeUserType = null;
|
||||
|
|
|
@ -8,21 +8,22 @@ package org.hibernate.orm.test.annotations.lob;
|
|||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.dialect.CockroachDialect;
|
||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||
import org.hibernate.metamodel.mapping.JdbcMapping;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
import org.hibernate.dialect.CockroachDialect;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
|
||||
import org.hibernate.type.descriptor.jdbc.BlobJdbcType;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
|
@ -38,10 +39,14 @@ public class MaterializedBlobTest extends BaseCoreFunctionalTestCase {
|
|||
@Test
|
||||
@SkipForDialect(value = CockroachDialect.class, comment = "Blob in CockroachDB is same as a varbinary, to assertions will fail")
|
||||
public void testTypeSelection() {
|
||||
int index = sessionFactory().getRuntimeMetamodels().getMappingMetamodel().getEntityDescriptor(MaterializedBlobEntity.class.getName()).getEntityMetamodel().getPropertyIndex( "theBytes" );
|
||||
BasicType<?> type = (BasicType<?>) sessionFactory().getRuntimeMetamodels().getMappingMetamodel().getEntityDescriptor(MaterializedBlobEntity.class.getName()).getEntityMetamodel().getProperties()[index].getType();
|
||||
assertTrue( type.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
||||
assertTrue( type.getJdbcType() instanceof BlobJdbcType );
|
||||
final EntityPersister entityDescriptor = sessionFactory().getRuntimeMetamodels()
|
||||
.getMappingMetamodel()
|
||||
.getEntityDescriptor( MaterializedBlobEntity.class.getName() );
|
||||
final AttributeMapping theBytesAttr = entityDescriptor.findAttributeMapping( "theBytes" );
|
||||
assertThat( theBytesAttr ).isInstanceOf( BasicValuedModelPart.class );
|
||||
final JdbcMapping mapping = ( (BasicValuedModelPart) theBytesAttr ).getJdbcMapping();
|
||||
assertTrue( mapping.getJavaTypeDescriptor() instanceof PrimitiveByteArrayJavaType );
|
||||
assertTrue( mapping.getJdbcType() instanceof BlobJdbcType );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -6,18 +6,13 @@
|
|||
*/
|
||||
package org.hibernate.orm.test.bytecode.enhancement.lazy;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.engine.FetchTiming;
|
||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedModelPart;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.tuple.NonIdentifierAttribute;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
|
||||
|
@ -27,6 +22,14 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import jakarta.persistence.Basic;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
@ -76,9 +79,9 @@ public class LazyBasicFieldNotInitializedTest extends BaseCoreFunctionalTestCase
|
|||
assertTrue( propertyLaziness[0] );
|
||||
|
||||
// Make sure NonIdentifierAttribute#isLazy is consistent (HHH-10551)
|
||||
NonIdentifierAttribute[] properties = entityPersister.getEntityMetamodel().getProperties();
|
||||
assertEquals( 1, properties.length );
|
||||
assertTrue( properties[0].isLazy() );
|
||||
final AttributeMapping theBytesAttr = entityPersister.findAttributeMapping( "description" );
|
||||
assertThat( theBytesAttr ).isInstanceOf( BasicValuedModelPart.class );
|
||||
assertThat( theBytesAttr.getMappedFetchOptions().getTiming() ).isEqualTo( FetchTiming.DELAYED );
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataNonPojoImpl;
|
||||
import org.hibernate.bytecode.spi.BytecodeEnhancementMetadata;
|
||||
import org.hibernate.cache.spi.access.CollectionDataAccess;
|
||||
import org.hibernate.cache.spi.access.EntityDataAccess;
|
||||
|
@ -61,17 +62,16 @@ import org.hibernate.persister.entity.EntityPersister;
|
|||
import org.hibernate.persister.entity.AttributeMappingsList;
|
||||
import org.hibernate.persister.spi.PersisterClassResolver;
|
||||
import org.hibernate.persister.spi.PersisterCreationContext;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.sql.ast.Clause;
|
||||
import org.hibernate.sql.ast.spi.SqlAstCreationState;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
|
||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
import org.hibernate.sql.ast.tree.predicate.Predicate;
|
||||
import org.hibernate.sql.results.graph.DomainResult;
|
||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||
import org.hibernate.tuple.entity.BytecodeEnhancementMetadataNonPojoImpl;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.CollectionType;
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataNonPojoImpl;
|
||||
import org.hibernate.bytecode.spi.BytecodeEnhancementMetadata;
|
||||
import org.hibernate.cache.spi.access.EntityDataAccess;
|
||||
import org.hibernate.cache.spi.access.NaturalIdDataAccess;
|
||||
|
@ -59,15 +60,14 @@ import org.hibernate.persister.entity.AttributeMappingsList;
|
|||
import org.hibernate.persister.internal.PersisterClassResolverInitiator;
|
||||
import org.hibernate.persister.spi.PersisterClassResolver;
|
||||
import org.hibernate.persister.spi.PersisterCreationContext;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.sql.ast.Clause;
|
||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
import org.hibernate.sql.results.graph.DomainResult;
|
||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||
import org.hibernate.tuple.entity.BytecodeEnhancementMetadataNonPojoImpl;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.Type;
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.HibernateException;
|
|||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.bytecode.internal.BytecodeEnhancementMetadataNonPojoImpl;
|
||||
import org.hibernate.bytecode.spi.BytecodeEnhancementMetadata;
|
||||
import org.hibernate.cache.spi.access.EntityDataAccess;
|
||||
import org.hibernate.cache.spi.access.NaturalIdDataAccess;
|
||||
|
@ -56,15 +57,14 @@ import org.hibernate.persister.entity.AttributeMappingsMap;
|
|||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.AttributeMappingsList;
|
||||
import org.hibernate.persister.spi.PersisterCreationContext;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableInsertStrategy;
|
||||
import org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy;
|
||||
import org.hibernate.spi.NavigablePath;
|
||||
import org.hibernate.sql.ast.Clause;
|
||||
import org.hibernate.sql.ast.spi.SqlSelection;
|
||||
import org.hibernate.sql.ast.tree.from.TableGroup;
|
||||
import org.hibernate.sql.results.graph.DomainResult;
|
||||
import org.hibernate.sql.results.graph.DomainResultCreationState;
|
||||
import org.hibernate.tuple.entity.BytecodeEnhancementMetadataNonPojoImpl;
|
||||
import org.hibernate.tuple.entity.EntityMetamodel;
|
||||
import org.hibernate.type.BasicType;
|
||||
import org.hibernate.type.Type;
|
||||
|
|
Loading…
Reference in New Issue