Package org.hibernate.generator.internal
Class GeneratedGeneration
java.lang.Object
org.hibernate.generator.internal.GeneratedGeneration
- All Implemented Interfaces:
Serializable,Generator,OnExecutionGenerator
A fairly generic
OnExecutionGenerator which marks a property as generated in the
database with semantics given explicitly by a @Generated annotation.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionGeneratedGeneration(EnumSet<EventType> eventTypes) GeneratedGeneration(Generated annotation) -
Method Summary
Modifier and TypeMethodDescriptionbooleanDetermine if this generator allows identifier values to be manually assigned to the entity instance before persisting it.booleanDetermine if this generator allows generated fields to be manually assigned a value on events which do not trigger value generation.booleangeneratedOnExecution(Object entity, SharedSessionContractImplementor session) Determines if the property value is generated when a row is written to the database.The event types for which this generator should be called to produce a new value.String[]getReferencedColumnValues(Dialect dialect) A SQL expression indicating how to calculate the generated values when the mapped columns are included in the SQL statement.booleanreferenceColumnsInSql(Dialect dialect) Determines if the columns whose values are generated are included in the column list of the SQLinsertorupdatestatement.booleanDetermines if the property values are written to JDBC as the argument of a JDBC?parameter.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.generator.Generator
generatedBeforeExecution, generatesOnForceIncrement, generatesOnInsert, generatesOnUpdate, generatesSometimesMethods inherited from interface org.hibernate.generator.OnExecutionGenerator
generatedOnExecution, getGeneratedIdentifierDelegate, getUniqueKeyPropertyNames
-
Constructor Details
-
GeneratedGeneration
-
GeneratedGeneration
-
-
Method Details
-
getEventTypes
Description copied from interface:GeneratorThe event types for which this generator should be called to produce a new value.Identifier generators must return
EventTypeSets.INSERT_ONLY.- Specified by:
getEventTypesin interfaceGenerator- Returns:
- a set of
EventTypes.
-
referenceColumnsInSql
Description copied from interface:OnExecutionGeneratorDetermines if the columns whose values are generated are included in the column list of the SQLinsertorupdatestatement. For example, this method should return:trueif the value is generated by calling a SQL function likecurrent_timestamp, orfalseif the value is generated by a trigger, bygenerated always as, or using a column default value.
- Specified by:
referenceColumnsInSqlin interfaceOnExecutionGenerator- Returns:
trueif the column is included in the column list of the SQL statement.
-
getReferencedColumnValues
Description copied from interface:OnExecutionGeneratorA SQL expression indicating how to calculate the generated values when the mapped columns are included in the SQL statement. The SQL expressions might be:- function calls like
current_timestampornextval('mysequence'), or - syntactic markers like
default.
- Specified by:
getReferencedColumnValuesin interfaceOnExecutionGenerator- Parameters:
dialect- The SQL dialect, allowing generation of an expression in dialect-specific SQL.- Returns:
- The column value to be used in the generated SQL statement.
- function calls like
-
writePropertyValue
public boolean writePropertyValue()Description copied from interface:OnExecutionGeneratorDetermines if the property values are written to JDBC as the argument of a JDBC?parameter.- Specified by:
writePropertyValuein interfaceOnExecutionGenerator
-
allowAssignedIdentifiers
public boolean allowAssignedIdentifiers()Description copied from interface:GeneratorDetermine if this generator allows identifier values to be manually assigned to the entity instance before persisting it. This is useful when, for example, needing existing assigned values to be used as identifiers and falling back to generated values by default.- Specified by:
allowAssignedIdentifiersin interfaceGenerator- Returns:
trueif this generator allows pre-assigned identifier values,falseotherwise (default).
-
allowMutation
public boolean allowMutation()Description copied from interface:GeneratorDetermine if this generator allows generated fields to be manually assigned a value on events which do not trigger value generation.- Specified by:
allowMutationin interfaceGenerator- Returns:
trueif this generator allows manually assigned values,falseotherwise (default).
-