Top Description Fields Constructors Methods
org.hibernate.metamodel.internal

public Class AttributeFactory

extends Object
Class Inheritance
Imports
java.lang.reflect.Field, .Member, .Method, .ParameterizedType, org.hibernate.AssertionFailure, .PropertyNotFoundException, org.hibernate.boot.model.convert.spi.ConverterDescriptor, org.hibernate.internal.EntityManagerMessageLogger, .HEMLogging, org.hibernate.mapping.Any, .Collection, .Component, .List, .Map, .OneToMany, .PersistentClass, .Property, .SimpleValue, .Value, org.hibernate.metamodel.AttributeClassification, .RepresentationMode, .UnsupportedMappingException, .ValueClassification, org.hibernate.metamodel.mapping.AttributeMapping, .CompositeIdentifierMapping, .EmbeddableMappingType, .EmbeddableValuedModelPart, .EntityIdentifierMapping, .EntityVersionMapping, org.hibernate.metamodel.model.domain.AbstractIdentifiableType, .DomainType, .EmbeddableDomainType, .IdentifiableDomainType, .ManagedDomainType, .PersistentAttribute, .SimpleDomainType, .SingularPersistentAttribute, org.hibernate.metamodel.model.domain.internal.AnyMappingDomainTypeImpl, .EmbeddableTypeImpl, .EntityTypeImpl, .MapMember, .MappedSuperclassTypeImpl, .PluralAttributeBuilder, .SingularAttributeImpl, org.hibernate.metamodel.spi.EmbeddableRepresentationStrategy, org.hibernate.persister.entity.EntityPersister, org.hibernate.property.access.internal.PropertyAccessMapImpl, org.hibernate.property.access.spi.Getter, org.hibernate.type.AnyType, .EntityType, org.hibernate.type.descriptor.java.JavaType, org.hibernate.type.spi.CompositeTypeImplementor, jakarta.persistence.ManyToMany, .OneToOne, jakarta.persistence.metamodel.Attribute, .Type

A factory for building Attribute instances. Exposes 3 main services for building
  1. normal attributes
  2. id attributes
  3. version attributes
Authors
Steve Ebersole, Emmanuel Bernard

Field Summary

Modifier and TypeField and Description
private final MetadataContext
private static final MemberResolver
private final MemberResolver
private static final EntityManagerMessageLogger
private static final MemberResolver
normalMemberResolver

A Member resolver for normal attributes.

private final MemberResolver
private static final MemberResolver

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static <Y> DomainType<Y>
public <
The type of the owner
X
,
The attribute type
Y
>
PersistentAttribute<X, Y>

Returns:

The built attribute descriptor or null if the attribute is not part of the JPA 2 model (eg backrefs)
buildAttribute
(ManagedDomainType<X>
The descriptor of the attribute owner (aka declarer).
ownerType
,
Property
The Hibernate property descriptor for the attribute
property
)

Build a normal attribute.

public static <X, Y> PersistentAttribute<X, Y>
buildAttribute(ManagedDomainType<X> ownerType, Property property, MetadataContext metadataContext)

public <
The type of the owner
X
,
The attribute type
Y
>
SingularPersistentAttribute<X, Y>

Returns:

The built attribute descriptor
buildIdAttribute
(IdentifiableDomainType<X>
The descriptor of the attribute owner (aka declarer).
ownerType
,
Property
The Hibernate property descriptor for the identifier attribute
property
)

Build the identifier attribute descriptor

public <
The type of the owner
X
,
The attribute type
Y
>
SingularAttributeImpl<X, Y>

Returns:

The built attribute descriptor
buildVersionAttribute
(IdentifiableDomainType<X>
The descriptor of the attribute owner (aka declarer).
ownerType
,
Property
The Hibernate property descriptor for the version attribute
property
)

Build the version attribute descriptor

private static <Y> EmbeddableDomainType<Y>
private <
The owner type
X
,
The attribute type
Y
>
AttributeMetadata<X, Y>

Returns:

The attribute description
determineAttributeMetadata
(AttributeContext<X>
The attribute to be described
attributeContext
,
MemberResolver
Strategy for how to resolve the member defining the attribute.
memberResolver
)

Here is most of the nuts and bolts of this factory, where we interpret the known JPA metadata against the known Hibernate metadata and build a descriptor for the attribute.

private static <X, Y> AttributeMetadata<X, Y>
determineAttributeMetadata(AttributeContext<X> attributeContext, MemberResolver memberResolver, MetadataContext context)

private static JavaType<?>
determineRelationalJavaType(ValueContext typeContext, DomainType<?> metaModelType, MetadataContext context)

private <Y> DomainType<Y>
public static <Y> DomainType<Y>
public static AttributeClassification
private static <Y> EmbeddableTypeImpl<Y>
private static <Y> EmbeddableDomainType<Y>
private static <Y> DomainType<Y>
private static EntityPersister
private static EntityPersister
public static ParameterizedType
public static boolean
private static <X> AttributeContext<X>
wrap(final ManagedDomainType<X> ownerType, final Property property)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contextback to summary
private final MetadataContext context
embeddedMemberResolverback to summary
private static final MemberResolver embeddedMemberResolver
identifierMemberResolverback to summary
private final MemberResolver identifierMemberResolver
LOGback to summary
private static final EntityManagerMessageLogger LOG
normalMemberResolverback to summary
private static final MemberResolver normalMemberResolver

A Member resolver for normal attributes.

versionMemberResolverback to summary
private final MemberResolver versionMemberResolver
virtualIdentifierMemberResolverback to summary
private static final MemberResolver virtualIdentifierMemberResolver

Constructor Detail

AttributeFactoryback to summary
public AttributeFactory(MetadataContext context)

Method Detail

basicDomainTypeback to summary
private static <Y> DomainType<Y> basicDomainType(ValueContext typeContext, MetadataContext context)
buildAttributeback to summary
public <X, Y> PersistentAttribute<X, Y> buildAttribute(ManagedDomainType<X> ownerType, Property property)

Build a normal attribute.

Parameters
<X>
The type of the owner
<Y>
The attribute type
ownerType:ManagedDomainType<X>

The descriptor of the attribute owner (aka declarer).

property:Property

The Hibernate property descriptor for the attribute

Returns:PersistentAttribute<X, Y>

The built attribute descriptor or null if the attribute is not part of the JPA 2 model (eg backrefs)

buildAttributeback to summary
public static <X, Y> PersistentAttribute<X, Y> buildAttribute(ManagedDomainType<X> ownerType, Property property, MetadataContext metadataContext)
buildIdAttributeback to summary
public <X, Y> SingularPersistentAttribute<X, Y> buildIdAttribute(IdentifiableDomainType<X> ownerType, Property property)

Build the identifier attribute descriptor

Parameters
<X>
The type of the owner
<Y>
The attribute type
ownerType:IdentifiableDomainType<X>

The descriptor of the attribute owner (aka declarer).

property:Property

The Hibernate property descriptor for the identifier attribute

Returns:SingularPersistentAttribute<X, Y>

The built attribute descriptor

buildVersionAttributeback to summary
public <X, Y> SingularAttributeImpl<X, Y> buildVersionAttribute(IdentifiableDomainType<X> ownerType, Property property)

Build the version attribute descriptor

Parameters
<X>
The type of the owner
<Y>
The attribute type
ownerType:IdentifiableDomainType<X>

The descriptor of the attribute owner (aka declarer).

property:Property

The Hibernate property descriptor for the version attribute

Returns:SingularAttributeImpl<X, Y>

The built attribute descriptor

classEmbeddableTypeback to summary
private static <Y> EmbeddableDomainType<Y> classEmbeddableType(MetadataContext context, Component component)
determineAttributeMetadataback to summary
private <X, Y> AttributeMetadata<X, Y> determineAttributeMetadata(AttributeContext<X> attributeContext, MemberResolver memberResolver)

Here is most of the nuts and bolts of this factory, where we interpret the known JPA metadata against the known Hibernate metadata and build a descriptor for the attribute.

Parameters
<X>
The owner type
<Y>
The attribute type
attributeContext:AttributeContext<X>

The attribute to be described

memberResolver:MemberResolver

Strategy for how to resolve the member defining the attribute.

Returns:AttributeMetadata<X, Y>

The attribute description

determineAttributeMetadataback to summary
private static <X, Y> AttributeMetadata<X, Y> determineAttributeMetadata(AttributeContext<X> attributeContext, MemberResolver memberResolver, MetadataContext context)
determineRelationalJavaTypeback to summary
private static JavaType<?> determineRelationalJavaType(ValueContext typeContext, DomainType<?> metaModelType, MetadataContext context)
determineSimpleTypeback to summary
private <Y> DomainType<Y> determineSimpleType(ValueContext typeContext)
determineSimpleTypeback to summary
public static <Y> DomainType<Y> determineSimpleType(ValueContext typeContext, MetadataContext context)
determineSingularAssociationClassificationback to summary
public static AttributeClassification determineSingularAssociationClassification(Member member)
dynamicEmbeddableTypeback to summary
private static <Y> EmbeddableTypeImpl<Y> dynamicEmbeddableType(MetadataContext context, Component component)
embeddableDomainTypeback to summary
private static <Y> EmbeddableDomainType<Y> embeddableDomainType(ValueContext typeContext, MetadataContext context)
entityDomainTypeback to summary
private static <Y> DomainType<Y> entityDomainType(ValueContext typeContext, MetadataContext context)
getDeclarerEntityPersisterback to summary
private static EntityPersister getDeclarerEntityPersister(AbstractIdentifiableType<?> ownerType, MetadataContext metadataContext)
getDeclaringEntityback to summary
private static EntityPersister getDeclaringEntity(AbstractIdentifiableType<?> ownerType, MetadataContext metadataContext)
getSignatureTypeback to summary
public static ParameterizedType getSignatureType(Member member)
isManyToManyback to summary
public static boolean isManyToMany(Member member)
wrapback to summary
private static <X> AttributeContext<X> wrap(final ManagedDomainType<X> ownerType, final Property property)