Interface IdentifierGenerator

    • Method Detail

      • configure

        default void configure​(Type type,
                               Properties parameters,
                               ServiceRegistry serviceRegistry)
        Configure this instance, given the value of parameters specified by the user as <param> elements.

        This method is called just once, following instantiation, and before registerExportables(Database).

        Specified by:
        configure in interface Configurable
        Parameters:
        type - The id property type descriptor
        parameters - param values, keyed by parameter name
        serviceRegistry - Access to service that may be needed.
        Throws:
        MappingException - If configuration fails.
      • initialize

        default void initialize​(SqlStringGenerationContext context)
        Initializes this instance, in particular pre-generates SQL as necessary.

        This method is called after registerExportables(Database), and before first use.

        Parameters:
        context - A context to help generate SQL strings
      • generate

        Object generate​(SharedSessionContractImplementor session,
                        Object object)
        Generate a new identifier.
        Parameters:
        session - The session from which the request originates
        object - the entity or collection (idbag) for which the id is being generated
        Returns:
        a new identifier
        Throws:
        HibernateException - Indicates trouble generating the identifier
      • generate

        default Object generate​(SharedSessionContractImplementor session,
                                Object owner,
                                Object currentValue,
                                EventType eventType)
        Generate a value.

        The currentValue is usually null for id generation.

        Specified by:
        generate in interface BeforeExecutionGenerator
        Parameters:
        session - The session from which the request originates.
        owner - The instance of the object owning the attribute for which we are generating a value.
        currentValue - The current value assigned to the property, or null
        eventType - The type of event that has triggered generation of a new value
        Returns:
        The generated value
      • supportsJdbcBatchInserts

        @Deprecated(since="6.2")
        default boolean supportsJdbcBatchInserts()
        Deprecated.
        this method is no longer called
        Check if JDBC batch inserts are supported.
        Returns:
        JDBC batch inserts are supported.