Interface Generator

    • Method Detail

      • generatedOnExecution

        boolean generatedOnExecution()
        Determines 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 BeforeExecutionGenerator must result false.
        • Generators which only implement OnExecutionGenerator must result true.
        • Generators which implement both subinterfaces may decide at runtime what value to return.
        Returns:
        true if the value is generated by the database as a side effect of the execution of an insert or update statement, or false if it is generated in Java code before the statement is executed via JDBC.
      • generatedOnExecution

        default boolean generatedOnExecution​(Object entity,
                                             SharedSessionContractImplementor session)
        Determines 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.

        Defaults to generatedOnExecution(), but can be overloaded allowing conditional value generation timing (on/before execution) based on the current state of the owner entity. Note that a generator must implement both BeforeExecutionGenerator and OnExecutionGenerator to achieve this behavior.

        Parameters:
        entity - The instance of the entity owning the attribute for which we are generating a value.
        session - The session from which the request originates.
        Returns:
        true if the value is generated by the database as a side effect of the execution of an insert or update statement, or false if it is generated in Java code before the statement is executed via JDBC.
        Since:
        6.4
        See Also:
        generatedOnExecution(), BeforeExecutionGenerator, OnExecutionGenerator
      • allowAssignedIdentifiers

        default boolean allowAssignedIdentifiers()
        Determine 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.
        Returns:
        true if this generator allows pre-assigned identifier values, false otherwise (default).
        Since:
        6.5
      • generatesSometimes

        default boolean generatesSometimes()
      • generatesOnInsert

        default boolean generatesOnInsert()
      • generatesOnUpdate

        default boolean generatesOnUpdate()