Interface JdbcFunction

All Known Implementing Classes:
AbstractDatetimeAddFunction, AbstractJdbcFunction, BirthdayQueryFunction, BoundingboxJdbcFunction, DateAddFunction, DatetimeAddFunction, DistanceHaversineJdbcFunction, DueDateFunction, SimilarityFunction

public interface JdbcFunction
This interface can be used to contribute additional query functions that are based on raw SQL.
  • Method Details

    • getName

      String getName()
    • createFunction

      org.hibernate.query.sqm.function.SqmFunctionDescriptor createFunction(org.hibernate.type.spi.TypeConfiguration typeConfiguration, SqlWriterBase.SqlWriterConfiguration sqlWriterConfiguration)
      Returns:
      an SqmFunctionDescriptor that contains the raw sql statement that is executed on the db.
    • argumentCount

      int argumentCount()
      Returns:
      the number of expected arguments.
    • getReturnType

      Class<?> getReturnType()
      Returns:
      the return type of the function
    • getFunctionArgumentTypeResolver

      org.hibernate.query.sqm.produce.function.FunctionArgumentTypeResolver getFunctionArgumentTypeResolver(org.hibernate.type.spi.TypeConfiguration typeConfiguration)
      Per default StandardFunctionArgumentTypeResolvers.ARGUMENT_OR_IMPLIED_RESULT_TYPE is used. Sometimes a more specific function resolver must be defined. For example the third argument of `BIRTHDAYIN` must be a string. Without a custom resolver Hibernate tries to convert "3 days" to a LocalDate which results in an exception.
    • validateArguments

      void validateArguments(jakarta.persistence.criteria.Expression<?>[] arguments) throws JdbcFunctionException
      Throws:
      JdbcFunctionException