Package org.hibernate.mapping
Class Component
- java.lang.Object
-
- org.hibernate.mapping.SimpleValue
-
- org.hibernate.mapping.Component
-
- All Implemented Interfaces:
Serializable
,KeyValue
,MetaAttributable
,SortableValue
,Value
public class Component extends SimpleValue implements MetaAttributable, SortableValue
A mapping model object that represents an embeddable class.- See Also:
- Serialized Form
- API Note:
- The name of this class is historical and unfortunate. An embeddable class holds a "component" of the state of an entity. It has absolutely nothing to do with modularity in software engineering.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Component.StandardGenerationContextLocator
static class
Component.ValueGenerationPlan
-
Field Summary
-
Fields inherited from class org.hibernate.mapping.SimpleValue
DEFAULT_ID_GEN_STRATEGY
-
-
Constructor Summary
Constructors Constructor Description Component(MetadataBuildingContext metadata, Collection collection)
Component(MetadataBuildingContext metadata, Component component)
Component(MetadataBuildingContext metadata, Join join)
Component(MetadataBuildingContext metadata, PersistentClass owner)
Component(MetadataBuildingContext metadata, Table table, PersistentClass owner)
-
Method Summary
-
Methods inherited from class org.hibernate.mapping.SimpleValue
addColumn, addFormula, copyTypeFrom, createForeignKey, createForeignKey, createForeignKeyOfEntity, createParameterImpl, createUniqueKey, disableForeignKey, getAttributeConverterDescriptor, getBuildingContext, getColumn, getConstraintColumnIterator, getCustomIdGeneratorCreator, getFetchMode, getForeignKeyDefinition, getForeignKeyName, getIdentifierGeneratorParameters, getIdentifierGeneratorProperties, getIdentifierGeneratorStrategy, getJpaAttributeConverterDescriptor, getMetadata, getNullValue, getOnDeleteAction, getServiceRegistry, getTable, getTypeConfiguration, getTypeName, getTypeParameters, hasFormula, isAlternateUniqueKey, isCascadeDeleteEnabled, isColumnInsertable, isColumnUpdateable, isConstrained, isForeignKeyEnabled, isLob, isNationalized, isNullable, isPartitionKey, isSame, isSame, isSimpleValue, isTypeSpecified, isUpdateable, isVersion, justAddColumn, justAddColumn, justAddFormula, makeLob, makeNationalized, makeParameterImpl, makeVersion, setAlternateUniqueKey, setAttributeConverterDescriptor, setCascadeDeleteEnabled, setCustomIdGeneratorCreator, setForeignKeyDefinition, setForeignKeyName, setIdentifierGeneratorParameters, setIdentifierGeneratorProperties, setIdentifierGeneratorProperties, setIdentifierGeneratorStrategy, setJpaAttributeConverterDescriptor, setNullValue, setOnDeleteAction, setPartitionKey, setTable, setTypeName, setTypeParameters, setTypeParameters, sortColumns
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.mapping.KeyValue
createIdentifierGenerator, createIdentifierGenerator
-
Methods inherited from interface org.hibernate.mapping.Value
getConstraintColumns, getExtraCreateTableInfo, getSelectableType, getVirtualSelectables
-
-
-
-
Constructor Detail
-
Component
public Component(MetadataBuildingContext metadata, PersistentClass owner) throws MappingException
- Throws:
MappingException
-
Component
public Component(MetadataBuildingContext metadata, Component component) throws MappingException
- Throws:
MappingException
-
Component
public Component(MetadataBuildingContext metadata, Join join) throws MappingException
- Throws:
MappingException
-
Component
public Component(MetadataBuildingContext metadata, Collection collection) throws MappingException
- Throws:
MappingException
-
Component
public Component(MetadataBuildingContext metadata, Table table, PersistentClass owner) throws MappingException
- Throws:
MappingException
-
-
Method Detail
-
getPropertySpan
public int getPropertySpan()
-
getPropertyIterator
@Deprecated @Remove public @Remove Iterator<Property> getPropertyIterator()
Deprecated.
-
addProperty
public void addProperty(Property p, org.hibernate.annotations.common.reflection.XClass declaringClass)
-
addProperty
public void addProperty(Property p)
-
addColumn
public void addColumn(Column column)
- Overrides:
addColumn
in classSimpleValue
-
getSelectables
public List<Selectable> getSelectables()
Description copied from interface:Value
The mapping to columns and formulas.- Specified by:
getSelectables
in interfaceValue
- Overrides:
getSelectables
in classSimpleValue
-
getColumns
public List<Column> getColumns()
Description copied from interface:Value
If the mapping involves only columns, return them.- Specified by:
getColumns
in interfaceValue
- Overrides:
getColumns
in classSimpleValue
-
isEmbedded
public boolean isEmbedded()
-
getAggregateColumn
public AggregateColumn getAggregateColumn()
-
setAggregateColumn
public void setAggregateColumn(AggregateColumn aggregateColumn)
-
getColumnSpan
public int getColumnSpan()
Description copied from interface:Value
The number of columns and formulas in the mapping.- Specified by:
getColumnSpan
in interfaceValue
- Overrides:
getColumnSpan
in classSimpleValue
-
getParentAggregateColumn
public AggregateColumn getParentAggregateColumn()
-
setParentAggregateColumn
public void setParentAggregateColumn(AggregateColumn parentAggregateColumn)
-
getStructName
public QualifiedName getStructName()
-
setStructName
public void setStructName(QualifiedName structName)
-
checkColumnDuplication
public void checkColumnDuplication(Set<String> distinctColumns, String owner)
Description copied from interface:Value
Checks if this value contains any duplicate column. A column is considered duplicate when itsname
is already contained in thedistinctColumn
set.If a duplicate column is found, a
MappingException
is thrown.- Specified by:
checkColumnDuplication
in interfaceValue
- Parameters:
distinctColumns
- set containing the names of the columns to checkowner
- the owner of this value, used just for error reporting
-
getComponentClassName
public String getComponentClassName()
-
getComponentClass
public Class<?> getComponentClass() throws MappingException
- Throws:
MappingException
-
getOwner
public PersistentClass getOwner()
-
getParentProperty
public String getParentProperty()
-
setComponentClassName
public void setComponentClassName(String componentClass)
-
setEmbedded
public void setEmbedded(boolean embedded)
-
setOwner
public void setOwner(PersistentClass owner)
-
setParentProperty
public void setParentProperty(String parentProperty)
-
isDynamic
public boolean isDynamic()
-
setDynamic
public void setDynamic(boolean dynamic)
-
getType
public CompositeType getType() throws MappingException
- Specified by:
getType
in interfaceValue
- Throws:
MappingException
-
setTypeUsingReflection
public void setTypeUsingReflection(String className, String propertyName) throws MappingException
- Specified by:
setTypeUsingReflection
in interfaceValue
- Overrides:
setTypeUsingReflection
in classSimpleValue
- Throws:
MappingException
-
getMetaAttributes
public Map<String,MetaAttribute> getMetaAttributes()
- Specified by:
getMetaAttributes
in interfaceMetaAttributable
-
getMetaAttribute
public MetaAttribute getMetaAttribute(String attributeName)
- Specified by:
getMetaAttribute
in interfaceMetaAttributable
-
setMetaAttributes
public void setMetaAttributes(Map<String,MetaAttribute> metas)
- Specified by:
setMetaAttributes
in interfaceMetaAttributable
-
accept
public Object accept(ValueVisitor visitor)
- Specified by:
accept
in interfaceValue
- Overrides:
accept
in classSimpleValue
-
isSame
public boolean isSame(SimpleValue other)
- Overrides:
isSame
in classSimpleValue
-
isSame
public boolean isSame(Component other)
-
getColumnInsertability
public boolean[] getColumnInsertability()
- Specified by:
getColumnInsertability
in interfaceValue
- Overrides:
getColumnInsertability
in classSimpleValue
-
hasAnyInsertableColumns
public boolean hasAnyInsertableColumns()
- Specified by:
hasAnyInsertableColumns
in interfaceValue
- Overrides:
hasAnyInsertableColumns
in classSimpleValue
-
getColumnUpdateability
public boolean[] getColumnUpdateability()
- Specified by:
getColumnUpdateability
in interfaceValue
- Overrides:
getColumnUpdateability
in classSimpleValue
-
hasAnyUpdatableColumns
public boolean hasAnyUpdatableColumns()
- Specified by:
hasAnyUpdatableColumns
in interfaceValue
- Overrides:
hasAnyUpdatableColumns
in classSimpleValue
-
isKey
public boolean isKey()
-
setKey
public void setKey(boolean isKey)
-
hasPojoRepresentation
public boolean hasPojoRepresentation()
-
getProperty
public Property getProperty(int index)
- Parameters:
index
- index of theProperty
to return- Returns:
Property
- Throws:
IndexOutOfBoundsException
- - if the index is out of range(index < 0 || index >=getPropertySpan()
)
-
getProperty
public Property getProperty(String propertyName) throws MappingException
- Throws:
MappingException
-
matchesAllProperties
public boolean matchesAllProperties(String... propertyNames)
-
hasProperty
public boolean hasProperty(String propertyName)
-
getRoleName
public String getRoleName()
-
setRoleName
public void setRoleName(String roleName)
-
getMappedSuperclass
public MappedSuperclass getMappedSuperclass()
-
setMappedSuperclass
public void setMappedSuperclass(MappedSuperclass mappedSuperclass)
-
getDiscriminator
public Value getDiscriminator()
-
setDiscriminator
public void setDiscriminator(Value discriminator)
-
getDiscriminatorType
public DiscriminatorType<?> getDiscriminatorType()
-
isPolymorphic
public boolean isPolymorphic()
-
setSubclassToSuperclass
public void setSubclassToSuperclass(Map<String,String> subclassToSuperclass)
-
toString
public String toString()
- Overrides:
toString
in classSimpleValue
-
createGenerator
public Generator createGenerator(IdentifierGeneratorFactory identifierGeneratorFactory, Dialect dialect, RootClass rootClass) throws MappingException
- Specified by:
createGenerator
in interfaceKeyValue
- Overrides:
createGenerator
in classSimpleValue
- Throws:
MappingException
-
clearProperties
public void clearProperties()
-
prepareForMappingModel
public void prepareForMappingModel()
-
isValid
public boolean isValid(Mapping mapping) throws MappingException
- Specified by:
isValid
in interfaceValue
- Overrides:
isValid
in classSimpleValue
- Throws:
MappingException
-
isSorted
public boolean isSorted()
- Specified by:
isSorted
in interfaceSortableValue
-
sortProperties
public int[] sortProperties()
- Specified by:
sortProperties
in interfaceSortableValue
-
setSimpleRecord
public void setSimpleRecord(boolean simpleRecord)
-
isSimpleRecord
public boolean isSimpleRecord()
-
getCustomInstantiator
public Class<? extends EmbeddableInstantiator> getCustomInstantiator()
-
setCustomInstantiator
public void setCustomInstantiator(Class<? extends EmbeddableInstantiator> customInstantiator)
-
getInstantiator
public Constructor<?> getInstantiator()
-
getInstantiatorPropertyNames
public String[] getInstantiatorPropertyNames()
-
setInstantiator
public void setInstantiator(Constructor<?> instantiator, String[] instantiatorPropertyNames)
-
getStructColumnNames
public String[] getStructColumnNames()
-
setStructColumnNames
public void setStructColumnNames(String[] structColumnNames)
-
isGeneric
public boolean isGeneric()
-
setGeneric
public void setGeneric(boolean generic)
-
-