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
A mapping model object that represents an embeddable class.
- See Also:
- API Note:
- The name of this class is historical and unfortunate. It reflects modeling a *composition* of state. It has absolutely nothing to do with modularity in software engineering.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classNested classes/interfaces inherited from interface org.hibernate.mapping.KeyValue
KeyValue.NullValueSemantic -
Field Summary
Fields inherited from class org.hibernate.mapping.SimpleValue
DEFAULT_ID_GEN_STRATEGY -
Constructor Summary
ConstructorsConstructorDescriptionComponent(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
Modifier and TypeMethodDescriptionaccept(ValueVisitor visitor) voidvoidvoidaddProperty(Property p, org.hibernate.models.spi.ClassDetails declaringClass) voidcheckColumnDuplication(Set<String> distinctColumns, String owner) Checks if this value contains any duplicate column.voidcopy()createGenerator(Dialect dialect, RootClass rootClass, Property property, GeneratorSettings defaults) boolean[]Column naming pattern applied to the componentIf the mapping involves only columns, return them.intThe number of columns and formulas in the mapping.boolean[]Class<?> Class<? extends EmbeddableInstantiator> Constructor<?> String[]getMetaAttribute(String attributeName) getOwner()getProperty(int index) getProperty(String propertyName) String[]intThe mapping to columns and formulas.String[]getSuperclass(String subclass) getType()booleanbooleanbooleanhasProperty(String propertyName) booleanbooleanbooleanbooleanisKey()booleanbooleanbooleanisSame(SimpleValue other) booleanbooleanisSorted()booleanisValid(MappingContext mappingContext) booleanmatchesAllProperties(String... propertyNames) voidvoidsetAggregateColumn(AggregateColumn aggregateColumn) voidsetColumnNamingPattern(String columnNamingPattern) Apply a column naming pattern.voidsetComponentClassName(String componentClass) voidsetCustomInstantiator(Class<? extends EmbeddableInstantiator> customInstantiator) voidsetDiscriminator(Value discriminator) voidsetDiscriminatorValues(Map<Object, String> discriminatorValues) voidsetDynamic(boolean dynamic) voidsetEmbedded(boolean embedded) voidsetGeneric(boolean generic) voidsetInstantiator(Constructor<?> instantiator, String[] instantiatorPropertyNames) voidsetKey(boolean isKey) voidsetMappedSuperclass(MappedSuperclass mappedSuperclass) voidsetMetaAttributes(Map<String, MetaAttribute> metas) voidsetOwner(PersistentClass owner) voidsetParentAggregateColumn(AggregateColumn parentAggregateColumn) voidsetParentProperty(String parentProperty) voidsetRoleName(String roleName) voidsetSimpleRecord(boolean simpleRecord) voidsetStructColumnNames(String[] structColumnNames) voidsetStructName(QualifiedName structName) voidsetSubclassToSuperclass(Map<String, String> subclassToSuperclass) voidsetTypeUsingReflection(String className, String propertyName) int[]toString()Methods inherited from class org.hibernate.mapping.SimpleValue
addColumn, addFormula, copyTypeFrom, createForeignKey, createForeignKey, createForeignKeyOfEntity, createForeignKeyOfEntity, createGenerator, createParameterType, createUniqueKey, disableForeignKey, getAttributeConverterDescriptor, getBuildingContext, getColumn, getCustomIdGeneratorCreator, getFetchMode, getForeignKeyDefinition, getForeignKeyName, getForeignKeyOptions, getJpaAttributeConverterDescriptor, getMetadata, getNullValue, getNullValueSemantic, 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, makeVersion, setAlternateUniqueKey, setAttributeConverterDescriptor, setColumnToIdentity, setCustomIdGeneratorCreator, setForeignKeyDefinition, setForeignKeyName, setForeignKeyOptions, setJpaAttributeConverterDescriptor, setNullValue, setNullValueSemantic, setNullValueUndefined, setOnDeleteAction, setPartitionKey, setTable, setTypeName, setTypeParameters, setTypeParameters, sortColumnsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.hibernate.mapping.Value
getConstraintColumns, getExtraCreateTableInfo, getSelectableType, getVirtualSelectables
-
Constructor Details
-
Component
- Throws:
MappingException
-
Component
- Throws:
MappingException
-
Component
- Throws:
MappingException
-
Component
- Throws:
MappingException
-
Component
public Component(MetadataBuildingContext metadata, Table table, PersistentClass owner) throws MappingException - Throws:
MappingException
-
-
Method Details
-
copy
-
getPropertySpan
public int getPropertySpan() -
getProperties
-
addProperty
-
addProperty
-
getPropertyDeclaringClass
-
addColumn
- Overrides:
addColumnin classSimpleValue
-
getSelectables
Description copied from interface:ValueThe mapping to columns and formulas.- Specified by:
getSelectablesin interfaceValue- Overrides:
getSelectablesin classSimpleValue
-
getColumns
Description copied from interface:ValueIf the mapping involves only columns, return them.- Specified by:
getColumnsin interfaceValue- Overrides:
getColumnsin classSimpleValue
-
isEmbedded
public boolean isEmbedded() -
getAggregateColumn
-
setAggregateColumn
-
getColumnSpan
public int getColumnSpan()Description copied from interface:ValueThe number of columns and formulas in the mapping.- Specified by:
getColumnSpanin interfaceValue- Overrides:
getColumnSpanin classSimpleValue
-
getAggregatedColumns
-
getParentAggregateColumn
-
setParentAggregateColumn
-
getStructName
-
setStructName
-
checkColumnDuplication
Description copied from interface:ValueChecks if this value contains any duplicate column. A column is considered duplicate when itsnameis already contained in thedistinctColumnset.If a duplicate column is found, a
MappingExceptionis thrown.- Specified by:
checkColumnDuplicationin interfaceValue- Parameters:
distinctColumns- set containing the names of the columns to checkowner- the owner of this value, used just for error reporting
-
getComponentClassName
-
getComponentClass
- Throws:
MappingException
-
getOwner
-
getParentProperty
-
setComponentClassName
-
setEmbedded
public void setEmbedded(boolean embedded) -
setOwner
-
setParentProperty
-
isDynamic
public boolean isDynamic() -
setDynamic
public void setDynamic(boolean dynamic) -
getType
- Specified by:
getTypein interfaceValue- Throws:
MappingException
-
setTypeUsingReflection
- Specified by:
setTypeUsingReflectionin interfaceValue- Overrides:
setTypeUsingReflectionin classSimpleValue- Throws:
MappingException
-
getMetaAttributes
- Specified by:
getMetaAttributesin interfaceMetaAttributable
-
getMetaAttribute
- Specified by:
getMetaAttributein interfaceMetaAttributable
-
setMetaAttributes
- Specified by:
setMetaAttributesin interfaceMetaAttributable
-
accept
- Specified by:
acceptin interfaceValue- Overrides:
acceptin classSimpleValue
-
isSame
- Overrides:
isSamein classSimpleValue
-
isSame
-
getColumnInsertability
public boolean[] getColumnInsertability()- Specified by:
getColumnInsertabilityin interfaceValue- Overrides:
getColumnInsertabilityin classSimpleValue
-
hasAnyInsertableColumns
public boolean hasAnyInsertableColumns()- Specified by:
hasAnyInsertableColumnsin interfaceValue- Overrides:
hasAnyInsertableColumnsin classSimpleValue
-
getColumnUpdateability
public boolean[] getColumnUpdateability()- Specified by:
getColumnUpdateabilityin interfaceValue- Overrides:
getColumnUpdateabilityin classSimpleValue
-
hasAnyUpdatableColumns
public boolean hasAnyUpdatableColumns()- Specified by:
hasAnyUpdatableColumnsin interfaceValue- Overrides:
hasAnyUpdatableColumnsin classSimpleValue
-
isKey
public boolean isKey() -
setKey
public void setKey(boolean isKey) -
getProperty
- Parameters:
index- index of thePropertyto return- Returns:
Property- Throws:
IndexOutOfBoundsException- - if the index is out of range(index < 0 || index >=getPropertySpan())
-
getProperty
- Throws:
MappingException
-
matchesAllProperties
-
hasProperty
-
getRoleName
-
setRoleName
-
getMappedSuperclass
-
setMappedSuperclass
-
getDiscriminator
-
setDiscriminator
-
getDiscriminatorType
-
isPolymorphic
public boolean isPolymorphic() -
getDiscriminatorValues
-
setDiscriminatorValues
-
getSuperclass
-
setSubclassToSuperclass
-
toString
- Overrides:
toStringin classSimpleValue
-
createGenerator
public Generator createGenerator(Dialect dialect, RootClass rootClass, Property property, GeneratorSettings defaults) - Specified by:
createGeneratorin interfaceKeyValue- Overrides:
createGeneratorin classSimpleValue
-
getPropertyNames
-
clearProperties
public void clearProperties() -
setColumnNamingPattern
Apply a column naming pattern.- See Also:
-
getColumnNamingPattern
Column naming pattern applied to the component- See Also:
-
prepareForMappingModel
public void prepareForMappingModel() -
isValid
- Specified by:
isValidin interfaceValue- Overrides:
isValidin classSimpleValue- Throws:
MappingException
-
isSorted
public boolean isSorted()- Specified by:
isSortedin interfaceSortableValue
-
sortProperties
public int[] sortProperties()- Specified by:
sortPropertiesin interfaceSortableValue
-
setSimpleRecord
public void setSimpleRecord(boolean simpleRecord) -
isSimpleRecord
public boolean isSimpleRecord() -
getCustomInstantiator
-
setCustomInstantiator
-
getInstantiator
-
getInstantiatorPropertyNames
-
setInstantiator
-
getStructColumnNames
-
setStructColumnNames
-
isGeneric
public boolean isGeneric() -
setGeneric
public void setGeneric(boolean generic)
-