BeforeExecutionGenerator with timing EventTypeSets#INSERT_ONLY
may now be used.
This interface extends BeforeExecutionGenerator with some additional
machinery for configuration, and for caching
generated SQL.
Any identifier generator, including a generator which directly implements
BeforeExecutionGenerator, may also implement ExportableProducer.
For the sake of convenience, PersistentIdentifierGenerator extends
ExportableProducer, in case the implementation needs to export
objects to the database as part of the process of schema export.
The configure(Type, Properties, ServiceRegistry) method accepts
a properties object containing named values. These include:
org.hibernate.annotations.GenericGenerator#parameters() .
Instances of IdentifierGenerator are usually created and configured
by the org. service.
It's not usually correct to use an IdentifierGenerator with the
org. meta-annotation.
PostInsertIdentifierGenerator, PersistentIdentifierGenerator
| Modifier and Type | Field and Description |
|---|---|
| public static final String | CONTRIBUTOR_NAME
The contributor that contributed this generator |
| public static final String | ENTITY_NAME
The configuration parameter holding the entity name |
| public static final String | GENERATOR_NAME
The configuration parameter holding the name of this identifier generator. |
| public static final String | JPA_ENTITY_NAME
The configuration parameter holding the JPA entity name |
| Modifier and Type | Method and Description |
|---|---|
| public default void | configure(Type
The id property type descriptor type, Properties param values, keyed by parameter name parameters, ServiceRegistry Access to service that may be needed. serviceRegistry)Implements org. <param> elements.
|
| public Object | Returns: a new identifierThe session from which the request originates session, Object the entity or collection (idbag) for which the id is being generated object)Generate a new identifier. |
| public default Object | generate(SharedSessionContractImplementor
The session from which the request originates. session, Object The instance of the object owning the attribute for which we are generating a value. owner, Object The current value assigned to the property, or currentValue, EventType nullThe type of event that has triggered generation of a new value eventType)Implements org. |
| public default EnumSet | Returns: EventTypeSets#INSERT_ONLYImplements org. |
| public default void | initialize(SqlStringGenerationContext
A context to help generate SQL strings context)Initializes this instance, in particular pre-generates SQL as necessary. |
| public default void | registerExportables(Database
The database instance database)Implements org. |
| public default boolean | Returns: JDBC batch inserts are supported.
Deprecated
since 6.2. this method is no longer called
Check if JDBC batch inserts are supported.
|
| CONTRIBUTOR_NAME | back to summary |
|---|---|
| public static final String CONTRIBUTOR_NAME The contributor that contributed this generator | |
| ENTITY_NAME | back to summary |
|---|---|
| public static final String ENTITY_NAME The configuration parameter holding the entity name | |
| GENERATOR_NAME | back to summary |
|---|---|
| public static final String GENERATOR_NAME The configuration parameter holding the name of this identifier generator. | |
| JPA_ENTITY_NAME | back to summary |
|---|---|
| public static final String JPA_ENTITY_NAME The configuration parameter holding the JPA entity name | |
| configure | back to summary |
|---|---|
| public default void configure(Type type, Properties parameters, ServiceRegistry serviceRegistry) Implements org. Configure this instance, given the value of parameters
specified by the user as
This method is called just once, following instantiation,
and before
| |
| generate | back to summary |
|---|---|
| public Object generate(SharedSessionContractImplementor session, Object object) Generate a new identifier.
| |
| generate | back to summary |
|---|---|
| public default Object generate(SharedSessionContractImplementor session, Object owner, Object currentValue, EventType eventType) Implements org. Generate a value.
The
| |
| getEventTypes | back to summary |
|---|---|
| public default EnumSet Implements org. Doc from org. The event types for which this generator should be called to produce a new value.
Identifier generators must return | |
| 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
| |
| registerExportables | back to summary |
|---|---|
| public default void registerExportables(Database database) Implements org. Register database objects used by this identifier generator, for example, a sequence or tables.
This method is called just once, after
| |
| supportsJdbcBatchInserts | back to summary |
|---|---|
| public default boolean supportsJdbcBatchInserts()
Deprecated since 6.2. this method is no longer called Check if JDBC batch inserts are supported.
| |