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(SessionImplementor session, Object
the entity or toplevel collection for which the id is being generated object)Implements org. |
| public void | registerPersistentGenerators(Map<K, V>
The map of generators. generatorMap)Implements org. PersistentIdentifierGenerator by their
generatorKey.
|
| generationContextLocator | back to summary |
|---|---|
| private final CompositeNestedGeneratedValueGenerator. | |
| generationPlans | back to summary |
|---|---|
| private List<E> generationPlans | |
| CompositeNestedGeneratedValueGenerator | back to summary |
|---|---|
| public CompositeNestedGeneratedValueGenerator(CompositeNestedGeneratedValueGenerator. | |
| addGeneratedValuePlan | back to summary |
|---|---|
| public void addGeneratedValuePlan(CompositeNestedGeneratedValueGenerator. | |
| generate | back to summary |
|---|---|
| public Serializable generate(SessionImplementor session, Object object) throws HibernateException Implements org. Doc from org. Generate a new identifier.
| |
| registerPersistentGenerators | back to summary |
|---|---|
| public void registerPersistentGenerators(Map<K, V> generatorMap) Implements org. Doc from org. Register any sub generators which implement
| |
| 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(SessionImplementor 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(SessionImplementor
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 void | registerPersistentGenerators(Map<K, V>
The map of generators. generatorMap)Register any sub generators which implement |
| execute | back to summary |
|---|---|
| public void execute(SessionImplementor session, Object incomingObject, Object injectionContext) Execute the value generation.
| |
| registerPersistentGenerators | back to summary |
|---|---|
| public void registerPersistentGenerators(Map<K, V> generatorMap) Register any sub generators which implement
| |