Deprecated
as a consequence of IdentifierGenerator being deprecated. See corresponding docs for further information.
This generator is used implicitly for all composite identifier scenarios if an explicit generator is not in place. So it make sense to discuss the various potential scenarios:
<composite-id/> (notice the lack of both a name and class attribute
declarations). The term "embedded"
here refers to the Hibernate usage which is actually the exact opposite of the JPA
meaning of "embedded". Essentially this means that the entity class itself holds
the named composite pk properties. This is very similar to the JPA @IdClass
usage, though without a separate pk-class for loading.
@EmbeddedId)
and HBM mappings (<composite-id name="idAttributeName" class="PkClassName"/>)
@IdClass use case
and is only possible in annotations
Most of the grunt work is done in org..
| Modifier and Type | Class and Description |
|---|---|
| public static interface | CompositeNestedGeneratedValueGenerator.GenerationContextLocator
Contract for declaring how to locate the context for sub-value injection. |
| public static interface | CompositeNestedGeneratedValueGenerator.GenerationPlan
Contract for performing the actual sub-value generation, usually injecting it into the
determined |
| Modifier and Type | Field and Description |
|---|---|
| private final CompositeNestedGeneratedValueGenerator. | |
| private List |
| Access | Constructor and Description |
|---|---|
| public | CompositeNestedGeneratedValueGenerator(CompositeNestedGeneratedValueGenerator.
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Serializable | generate(SharedSessionContractImplementor
The session from which the request originates session, Object the entity or collection (idbag) for which the id is being generated object)Implements org. |
| public void | initialize(SqlStringGenerationContext
A context to help generate SQL strings context)Overrides default org. |
| public void | registerExportables(Database
The database instance database)Overrides default org. Implements org.
This method is called just once, after |
| generationContextLocator | back to summary |
|---|---|
| private final CompositeNestedGeneratedValueGenerator. | |
| generationPlans | back to summary |
|---|---|
| private List<CompositeNestedGeneratedValueGenerator. | |
| CompositeNestedGeneratedValueGenerator | back to summary |
|---|---|
| public CompositeNestedGeneratedValueGenerator(CompositeNestedGeneratedValueGenerator. | |
| addGeneratedValuePlan | back to summary |
|---|---|
| public void addGeneratedValuePlan(CompositeNestedGeneratedValueGenerator. | |
| generate | back to summary |
|---|---|
| public Serializable generate(SharedSessionContractImplementor session, Object object) throws HibernateException Implements org. Doc from org. Generate a new identifier.
| |
| initialize | back to summary |
|---|---|
| public void initialize(SqlStringGenerationContext context) Overrides default org. Doc from org. Initializes this instance, in particular pre-generates SQL as necessary.
This method is called after
| |
| registerExportables | back to summary |
|---|---|
| public void registerExportables(Database database) Overrides default org. Implements org. Doc from org. Register database objects used by this identifier generator, e.g. sequences, tables, etc.
This method is called just once, after | |
| Modifier and Type | Method and Description |
|---|---|
| public Serializable | Returns: The injection contextThe current session session, Object The entity for which we are generating id incomingObject)Given the incoming object, determine the context for injecting back its generated id sub-values. |
| locateGenerationContext | back to summary |
|---|---|
| public Serializable locateGenerationContext(SharedSessionContractImplementor session, Object incomingObject) Given the incoming object, determine the context for injecting back its generated id sub-values.
| |
context
| Modifier and Type | Method and Description |
|---|---|
| public void | execute(SharedSessionContractImplementor
The current session session, Object The entity for which we are generating id incomingObject, Object The context into which the generated value can be injected injectionContext)Execute the value generation. |
| public default void | initialize(SqlStringGenerationContext
A context to help generate SQL strings context)Initializes this instance, in particular pre-generates SQL as necessary. |
| execute | back to summary |
|---|---|
| public void execute(SharedSessionContractImplementor session, Object incomingObject, Object injectionContext) Execute the value generation.
| |
| initialize | back to summary |
|---|---|
| public default void initialize(SqlStringGenerationContext context) Initializes this instance, in particular pre-generates SQL as necessary.
This method is called after
| |