Package org.hibernate.mapping
Class BasicValue
- java.lang.Object
-
- org.hibernate.mapping.SimpleValue
-
- org.hibernate.mapping.BasicValue
-
- All Implemented Interfaces:
Serializable
,JpaAttributeConverterCreationContext
,KeyValue
,Resolvable
,Value
,JdbcTypeIndicators
- Direct Known Subclasses:
DependantBasicValue
public class BasicValue extends SimpleValue implements JdbcTypeIndicators, Resolvable, JpaAttributeConverterCreationContext
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BasicValue.Resolution<J>
Resolved form ofBasicValue
as part of interpreting the boot-time model into the run-time model
-
Field Summary
-
Fields inherited from class org.hibernate.mapping.SimpleValue
DEFAULT_ID_GEN_STRATEGY
-
Fields inherited from interface org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators
NO_COLUMN_LENGTH, NO_COLUMN_PRECISION, NO_COLUMN_SCALE
-
-
Constructor Summary
Constructors Constructor Description BasicValue(MetadataBuildingContext buildingContext)
BasicValue(MetadataBuildingContext buildingContext, Table table)
BasicValue(BasicValue original)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
accept(ValueVisitor visitor)
void
addColumn(Column incomingColumn)
void
addColumn(Column incomingColumn, boolean isInsertable, boolean isUpdatable)
void
addFormula(Formula formula)
protected BasicValue.Resolution<?>
buildResolution()
BasicValue
copy()
void
copyTypeFrom(SimpleValue sourceValue)
SelectablePath
createSelectablePath(String selectableName)
AggregateColumn
getAggregateColumn()
Selectable
getColumn()
long
getColumnLength()
Useful for resolutions based on column length.int
getColumnPrecision()
Useful for resolutions based on column precision.int
getColumnScale()
Useful for resolutions based on column scale.TimeZoneStorageStrategy
getDefaultTimeZoneStorageStrategy()
The defaultTimeZoneStorageStrategy
.Dialect
getDialect()
EnumType
getEnumeratedType()
For enum mappings, what style of storage was requested (name vs.EnumType
getEnumerationStyle()
Integer
getExplicitJdbcTypeCode()
Used (for now) only to choose a containerJdbcType
for SQL arrays.String
getExtraCreateTableInfo()
ManagedBeanRegistry
getManagedBeanRegistry()
int
getPreferredSqlTypeCodeForArray()
When mapping a basic array or collection type to the database what is the preferred SQL type code to use?int
getPreferredSqlTypeCodeForBoolean()
When mapping a boolean type to the database what is the preferred SQL type code to use?int
getPreferredSqlTypeCodeForDuration()
When mapping a duration type to the database what is the preferred SQL type code to use?int
getPreferredSqlTypeCodeForInstant()
When mapping an instant type to the database what is the preferred SQL type code to use?int
getPreferredSqlTypeCodeForUuid()
When mapping an uuid type to the database what is the preferred SQL type code to use?BasicValue.Resolution<?>
getResolution()
Type
getResolvedJavaType()
SoftDeleteType
getSoftDeleteStrategy()
TemporalType
getTemporalPrecision()
For temporal type mappings, what precision was requested?TimeZoneStorageType
getTimeZoneStorageType()
Type
getType()
boolean
isDisallowedWrapperArray()
boolean
isPreferJavaTimeJdbcTypesEnabled()
boolean
isPreferNativeEnumTypesEnabled()
boolean
isSoftDelete()
void
makeSoftDelete(SoftDeleteType strategy)
BasicValue.Resolution<?>
resolve()
boolean
resolve(MetadataBuildingContext buildingContext)
int
resolveJdbcTypeCode(int jdbcTypeCode)
Resolves the given type code to a possibly different type code, based on context.void
setAggregateColumn(AggregateColumn aggregateColumn)
void
setEnumerationStyle(EnumType enumerationStyle)
void
setExplicitCustomType(Class<? extends UserType<?>> explicitCustomType)
void
setExplicitJavaTypeAccess(Function<TypeConfiguration,BasicJavaType> explicitJavaTypeAccess)
void
setExplicitJdbcTypeAccess(Function<TypeConfiguration,JdbcType> jdbcTypeAccess)
void
setExplicitJdbcTypeCode(Integer jdbcTypeCode)
void
setExplicitMutabilityPlanAccess(Function<TypeConfiguration,MutabilityPlan> explicitMutabilityPlanAccess)
void
setExplicitTypeName(String typeName)
void
setExplicitTypeParams(Map<String,String> explicitLocalTypeParams)
void
setImplicitJavaTypeAccess(Function<TypeConfiguration,Type> implicitJavaTypeAccess)
void
setJpaAttributeConverterDescriptor(ConverterDescriptor descriptor)
void
setTemporalPrecision(TemporalType temporalPrecision)
void
setTimeZoneStorageType(TimeZoneStorageType timeZoneStorageType)
void
setTypeName(String typeName)
void
setTypeUsingReflection(String className, String propertyName)
static TimeZoneStorageStrategy
timeZoneStorageStrategy(TimeZoneStorageType timeZoneStorageType, MetadataBuildingContext buildingContext)
-
Methods inherited from class org.hibernate.mapping.SimpleValue
createForeignKey, createForeignKey, createForeignKeyOfEntity, createGenerator, createParameterImpl, createUniqueKey, disableForeignKey, getAttributeConverterDescriptor, getBuildingContext, getColumn, getColumnInsertability, getColumns, getColumnSpan, getColumnUpdateability, getConstraintColumnIterator, getCustomIdGeneratorCreator, getFetchMode, getForeignKeyDefinition, getForeignKeyName, getIdentifierGeneratorParameters, getIdentifierGeneratorProperties, getIdentifierGeneratorStrategy, getJpaAttributeConverterDescriptor, getMetadata, getNullValue, getOnDeleteAction, getSelectables, getServiceRegistry, getTable, getTypeConfiguration, getTypeName, getTypeParameters, hasAnyInsertableColumns, hasAnyUpdatableColumns, hasFormula, isAlternateUniqueKey, isCascadeDeleteEnabled, isColumnInsertable, isColumnUpdateable, isConstrained, isForeignKeyEnabled, isLob, isNationalized, isNullable, isPartitionKey, isSame, isSame, isSame, isSimpleValue, isTypeSpecified, isUpdateable, isValid, isVersion, justAddColumn, justAddColumn, justAddFormula, makeLob, makeNationalized, makeParameterImpl, makeVersion, setAlternateUniqueKey, setAttributeConverterDescriptor, setCascadeDeleteEnabled, setCustomIdGeneratorCreator, setForeignKeyDefinition, setForeignKeyName, setIdentifierGeneratorParameters, setIdentifierGeneratorProperties, setIdentifierGeneratorProperties, setIdentifierGeneratorStrategy, setNullValue, setOnDeleteAction, setPartitionKey, setTable, setTypeParameters, setTypeParameters, sortColumns, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.type.descriptor.jdbc.JdbcTypeIndicators
getDefaultZonedTimeSqlType, getDefaultZonedTimestampSqlType, getJdbcType, getTypeConfiguration, isLob, isNationalized
-
Methods inherited from interface org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext
getJavaTypeRegistry, getTypeConfiguration
-
Methods inherited from interface org.hibernate.mapping.KeyValue
createIdentifierGenerator, createIdentifierGenerator
-
Methods inherited from interface org.hibernate.mapping.Value
checkColumnDuplication, getConstraintColumns, getSelectableType, getVirtualSelectables
-
-
-
-
Constructor Detail
-
BasicValue
public BasicValue(MetadataBuildingContext buildingContext)
-
BasicValue
public BasicValue(MetadataBuildingContext buildingContext, Table table)
-
BasicValue
public BasicValue(BasicValue original)
-
-
Method Detail
-
copy
public BasicValue copy()
-
isSoftDelete
public boolean isSoftDelete()
-
getSoftDeleteStrategy
public SoftDeleteType getSoftDeleteStrategy()
-
makeSoftDelete
public void makeSoftDelete(SoftDeleteType strategy)
-
setTypeUsingReflection
public void setTypeUsingReflection(String className, String propertyName) throws MappingException
- Specified by:
setTypeUsingReflection
in interfaceValue
- Overrides:
setTypeUsingReflection
in classSimpleValue
- Throws:
MappingException
-
setEnumerationStyle
public void setEnumerationStyle(EnumType enumerationStyle)
-
getEnumerationStyle
public EnumType getEnumerationStyle()
-
getTimeZoneStorageType
public TimeZoneStorageType getTimeZoneStorageType()
-
setTimeZoneStorageType
public void setTimeZoneStorageType(TimeZoneStorageType timeZoneStorageType)
-
setJpaAttributeConverterDescriptor
public void setJpaAttributeConverterDescriptor(ConverterDescriptor descriptor)
- Overrides:
setJpaAttributeConverterDescriptor
in classSimpleValue
-
setExplicitJavaTypeAccess
public void setExplicitJavaTypeAccess(Function<TypeConfiguration,BasicJavaType> explicitJavaTypeAccess)
-
setExplicitJdbcTypeAccess
public void setExplicitJdbcTypeAccess(Function<TypeConfiguration,JdbcType> jdbcTypeAccess)
-
setExplicitMutabilityPlanAccess
public void setExplicitMutabilityPlanAccess(Function<TypeConfiguration,MutabilityPlan> explicitMutabilityPlanAccess)
-
setImplicitJavaTypeAccess
public void setImplicitJavaTypeAccess(Function<TypeConfiguration,Type> implicitJavaTypeAccess)
-
getColumn
public Selectable getColumn()
-
getResolvedJavaType
public Type getResolvedJavaType()
-
getColumnLength
public long getColumnLength()
Description copied from interface:JdbcTypeIndicators
Useful for resolutions based on column length.E.g. for choosing between a
VARCHAR
(String
) andCHAR(1)
(Character
/char
).- Specified by:
getColumnLength
in interfaceJdbcTypeIndicators
-
getColumnPrecision
public int getColumnPrecision()
Description copied from interface:JdbcTypeIndicators
Useful for resolutions based on column precision.- Specified by:
getColumnPrecision
in interfaceJdbcTypeIndicators
-
getColumnScale
public int getColumnScale()
Description copied from interface:JdbcTypeIndicators
Useful for resolutions based on column scale.E.g. for choosing between a
NUMERIC
andINTERVAL SECOND
.- Specified by:
getColumnScale
in interfaceJdbcTypeIndicators
-
addColumn
public void addColumn(Column incomingColumn)
- Overrides:
addColumn
in classSimpleValue
-
copyTypeFrom
public void copyTypeFrom(SimpleValue sourceValue)
- Overrides:
copyTypeFrom
in classSimpleValue
-
addColumn
public void addColumn(Column incomingColumn, boolean isInsertable, boolean isUpdatable)
- Overrides:
addColumn
in classSimpleValue
-
addFormula
public void addFormula(Formula formula)
- Overrides:
addFormula
in classSimpleValue
-
getType
public Type getType() throws MappingException
- Specified by:
getType
in interfaceValue
- Throws:
MappingException
-
getResolution
public BasicValue.Resolution<?> getResolution()
-
resolve
public boolean resolve(MetadataBuildingContext buildingContext)
- Specified by:
resolve
in interfaceResolvable
-
resolve
public BasicValue.Resolution<?> resolve()
- Specified by:
resolve
in interfaceResolvable
-
getExtraCreateTableInfo
public String getExtraCreateTableInfo()
- Specified by:
getExtraCreateTableInfo
in interfaceValue
-
getDialect
public Dialect getDialect()
- Specified by:
getDialect
in interfaceJdbcTypeIndicators
-
getAggregateColumn
public AggregateColumn getAggregateColumn()
-
setAggregateColumn
public void setAggregateColumn(AggregateColumn aggregateColumn)
-
createSelectablePath
public SelectablePath createSelectablePath(String selectableName)
-
buildResolution
protected BasicValue.Resolution<?> buildResolution()
-
getManagedBeanRegistry
public ManagedBeanRegistry getManagedBeanRegistry()
- Specified by:
getManagedBeanRegistry
in interfaceJpaAttributeConverterCreationContext
-
getEnumeratedType
public EnumType getEnumeratedType()
Description copied from interface:JdbcTypeIndicators
For enum mappings, what style of storage was requested (name vs. ordinal)?- Specified by:
getEnumeratedType
in interfaceJdbcTypeIndicators
- Returns:
- The enum type.
-
getPreferredSqlTypeCodeForBoolean
public int getPreferredSqlTypeCodeForBoolean()
Description copied from interface:JdbcTypeIndicators
When mapping a boolean type to the database what is the preferred SQL type code to use?Returns a key into the
JdbcTypeRegistry
.- Specified by:
getPreferredSqlTypeCodeForBoolean
in interfaceJdbcTypeIndicators
- See Also:
MappingSettings.PREFERRED_BOOLEAN_JDBC_TYPE
,Dialect.getPreferredSqlTypeCodeForBoolean()
-
getPreferredSqlTypeCodeForDuration
public int getPreferredSqlTypeCodeForDuration()
Description copied from interface:JdbcTypeIndicators
When mapping a duration type to the database what is the preferred SQL type code to use?Returns a key into the
JdbcTypeRegistry
.- Specified by:
getPreferredSqlTypeCodeForDuration
in interfaceJdbcTypeIndicators
- See Also:
MappingSettings.PREFERRED_DURATION_JDBC_TYPE
-
getPreferredSqlTypeCodeForUuid
public int getPreferredSqlTypeCodeForUuid()
Description copied from interface:JdbcTypeIndicators
When mapping an uuid type to the database what is the preferred SQL type code to use?Returns a key into the
JdbcTypeRegistry
.- Specified by:
getPreferredSqlTypeCodeForUuid
in interfaceJdbcTypeIndicators
- See Also:
MappingSettings.PREFERRED_UUID_JDBC_TYPE
-
getPreferredSqlTypeCodeForInstant
public int getPreferredSqlTypeCodeForInstant()
Description copied from interface:JdbcTypeIndicators
When mapping an instant type to the database what is the preferred SQL type code to use?Returns a key into the
JdbcTypeRegistry
.- Specified by:
getPreferredSqlTypeCodeForInstant
in interfaceJdbcTypeIndicators
- See Also:
MappingSettings.PREFERRED_INSTANT_JDBC_TYPE
-
getPreferredSqlTypeCodeForArray
public int getPreferredSqlTypeCodeForArray()
Description copied from interface:JdbcTypeIndicators
When mapping a basic array or collection type to the database what is the preferred SQL type code to use?Returns a key into the
JdbcTypeRegistry
.- Specified by:
getPreferredSqlTypeCodeForArray
in interfaceJdbcTypeIndicators
- See Also:
Dialect.getPreferredSqlTypeCodeForArray()
-
resolveJdbcTypeCode
public int resolveJdbcTypeCode(int jdbcTypeCode)
Description copied from interface:JdbcTypeIndicators
Resolves the given type code to a possibly different type code, based on context. A database might not support a certain type code in certain scenarios like within a UDT and has to resolve to a different type code in such a scenario.- Specified by:
resolveJdbcTypeCode
in interfaceJdbcTypeIndicators
- Parameters:
jdbcTypeCode
- a type code fromSqlTypes
- Returns:
- The jdbc type code to use
-
getDefaultTimeZoneStorageStrategy
public TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy()
Description copied from interface:JdbcTypeIndicators
The defaultTimeZoneStorageStrategy
.- Specified by:
getDefaultTimeZoneStorageStrategy
in interfaceJdbcTypeIndicators
- See Also:
MappingSettings.TIMEZONE_DEFAULT_STORAGE
,Dialect.getTimeZoneSupport()
-
timeZoneStorageStrategy
@Internal public static TimeZoneStorageStrategy timeZoneStorageStrategy(TimeZoneStorageType timeZoneStorageType, MetadataBuildingContext buildingContext)
-
setExplicitTypeParams
public void setExplicitTypeParams(Map<String,String> explicitLocalTypeParams)
-
setExplicitTypeName
public void setExplicitTypeName(String typeName)
-
setTypeName
public void setTypeName(String typeName)
- Overrides:
setTypeName
in classSimpleValue
-
setExplicitCustomType
public void setExplicitCustomType(Class<? extends UserType<?>> explicitCustomType)
-
setTemporalPrecision
public void setTemporalPrecision(TemporalType temporalPrecision)
-
getTemporalPrecision
public TemporalType getTemporalPrecision()
Description copied from interface:JdbcTypeIndicators
For temporal type mappings, what precision was requested?- Specified by:
getTemporalPrecision
in interfaceJdbcTypeIndicators
-
isPreferJavaTimeJdbcTypesEnabled
public boolean isPreferJavaTimeJdbcTypesEnabled()
- Specified by:
isPreferJavaTimeJdbcTypesEnabled
in interfaceJdbcTypeIndicators
- See Also:
MappingSettings.JAVA_TIME_USE_DIRECT_JDBC
-
isPreferNativeEnumTypesEnabled
public boolean isPreferNativeEnumTypesEnabled()
- Specified by:
isPreferNativeEnumTypesEnabled
in interfaceJdbcTypeIndicators
- See Also:
MappingSettings.PREFER_NATIVE_ENUM_TYPES
-
accept
public Object accept(ValueVisitor visitor)
- Specified by:
accept
in interfaceValue
- Overrides:
accept
in classSimpleValue
-
isDisallowedWrapperArray
@Internal public boolean isDisallowedWrapperArray()
-
setExplicitJdbcTypeCode
@Incubating public void setExplicitJdbcTypeCode(Integer jdbcTypeCode)
-
getExplicitJdbcTypeCode
public Integer getExplicitJdbcTypeCode()
Description copied from interface:JdbcTypeIndicators
Used (for now) only to choose a containerJdbcType
for SQL arrays.- Specified by:
getExplicitJdbcTypeCode
in interfaceJdbcTypeIndicators
-
-