Package org.hibernate.generator
Class Assigned
java.lang.Object
org.hibernate.generator.Assigned
- All Implemented Interfaces:
Serializable,Generator
- Direct Known Subclasses:
Assigned
A
Generator that doesn't generate.
Identifier fields with an Assigned generator
must be assigned a value by the application program.
This replaces the Assigned
identifier generation strategy from older versions
of Hibernate.
- Since:
- 7.0
- See Also:
-
Constructor Summary
Constructors -
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.booleangeneratedBeforeExecution(Object entity, SharedSessionContractImplementor session) Determines if the property value is generated before in Java code that executes before the row is written.booleanDetermines if the property value is generated when a row is written to the database, or in Java code that executes before the row is written.booleangeneratedOnExecution(Object entity, SharedSessionContractImplementor session) Determines if the property value is generated when a row is written to the database.booleanbooleanbooleanThe event types for which this generator should be called to produce a new value.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
generatesOnForceIncrement
-
Constructor Details
-
Assigned
public Assigned()
-
-
Method Details
-
generatedOnExecution
public boolean generatedOnExecution()Description copied from interface:GeneratorDetermines if the property value is generated when a row is written to the database, or in Java code that executes before the row is written.- Generators which only implement
BeforeExecutionGeneratormust resultfalse. - Generators which only implement
OnExecutionGeneratormust resulttrue. - Generators which implement both subinterfaces may decide at runtime what value to return.
- Specified by:
generatedOnExecutionin interfaceGenerator- Returns:
trueif the value is generated by the database as a side effect of the execution of aninsertorupdatestatement, or false if it is generated in Java code before the statement is executed via JDBC.
- Generators which only implement
-
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).
-
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.
-
generatesSometimes
public boolean generatesSometimes()- Specified by:
generatesSometimesin interfaceGenerator
-
generatesOnInsert
public boolean generatesOnInsert()- Specified by:
generatesOnInsertin interfaceGenerator
-
generatesOnUpdate
public boolean generatesOnUpdate()- Specified by:
generatesOnUpdatein interfaceGenerator
-