Interface ValueGeneration

    • Method Detail

      • getValueGenerator

        ValueGenerator<?> getValueGenerator()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Obtain the Java value generator, if the value is generated in Java, or return null if the value is generated by the database.
        Returns:
        The value generator
      • generate

        default Object generate​(SharedSessionContractImplementor session,
                                Object owner,
                                Object currentValue,
                                EventType eventType)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: BeforeExecutionGenerator
        Generate a value.
        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
      • referenceColumnInSql

        boolean referenceColumnInSql()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Determines if the column whose value is generated is included in the column list of the SQL insert or update statement, in the case where the value is generated by the database. For example, this method should return:

        If the value is generated in Java, this method is not called, and so for backward compatibility with Hibernate 5 it is permitted to return any value. On the other hand, when a property value is generated in Java, the column certainly must be included in the column list, and so it's most correct for this method to return true!

        Returns:
        true if the column is included in the column list of the SQL statement.
      • getDatabaseGeneratedReferencedColumnValue

        String getDatabaseGeneratedReferencedColumnValue()
        Deprecated, for removal: This API element is subject to removal in a future version.
        A SQL expression indicating how to calculate the generated value when the property value is generated in the database and the mapped column is included in the SQL statement. The SQL expression might be:
        • a function call like current_timestamp or nextval('mysequence'), or
        • a syntactic marker like default.

        When the property value is generated in Java, this method is not called, and its value is implicitly the string "?", that is, a JDBC parameter to which the generated value is bound.

        Returns:
        The column value to be used in the generated SQL statement.
      • getDatabaseGeneratedReferencedColumnValue

        default String getDatabaseGeneratedReferencedColumnValue​(Dialect dialect)
        Deprecated, for removal: This API element is subject to removal in a future version.
        A SQL expression indicating how to calculate the generated value when the property value is generated in the database and the mapped column is included in the SQL statement. The SQL expression might be:
        • a function call like current_timestamp or nextval('mysequence'), or
        • a syntactic marker like default.

        When the property value is generated in Java, this method is not called, and its value is implicitly the string "?", that is, a JDBC parameter to which the generated value is bound.

        Parameters:
        dialect - The SQL dialect, allowing generation of an expression in dialect-specific SQL.
        Returns:
        The column value to be used in the generated SQL statement.
      • getReferencedColumnValues

        default String[] getReferencedColumnValues​(Dialect dialect)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: OnExecutionGenerator
        A SQL expression indicating how to calculate the generated values when the mapped columns are included in the SQL statement. The SQL expressions might be:
        • function calls like current_timestamp or nextval('mysequence'), or
        • syntactic markers like default.
        Specified by:
        getReferencedColumnValues in interface OnExecutionGenerator
        Parameters:
        dialect - The SQL dialect, allowing generation of an expression in dialect-specific SQL.
        Returns:
        The column value to be used in the generated SQL statement.
      • referenceColumnsInSql

        default boolean referenceColumnsInSql​(Dialect dialect)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Description copied from interface: OnExecutionGenerator
        Determines if the columns whose values are generated are included in the column list of the SQL insert or update statement. For example, this method should return:
        Specified by:
        referenceColumnsInSql in interface OnExecutionGenerator
        Returns:
        true if the column is included in the column list of the SQL statement.