Class JdbcParameterFactory

java.lang.Object
org.hibernate.sql.ast.spi.query.expression.JdbcParameterFactory

@SPI(USE) public final class JdbcParameterFactory extends Object

Creates JDBC parameter expressions for SQL AST translation without exposing Hibernate's concrete parameter implementations.

Use queryLimit(TypeConfiguration) and queryOffset(TypeConfiguration) for pagination placeholders whose values come from the current query options instead of ordinary JDBC parameter bindings. Use custom(JdbcMapping, JdbcParameterBinder) when a provider-defined placeholder obtains its value through a custom binder.

Every invocation creates a distinct parameter. When a parameter is rendered into a command, add its [JdbcParameter#getParameterBinder() parameter binder] at the corresponding placeholder position and retain the same parameter instance for any operation metadata which identifies that placeholder.

Since:
8.0
  • Method Details

    • queryLimit

      @Nonnull public static JdbcParameter queryLimit(@Nonnull TypeConfiguration typeConfiguration)

      Create a query-limit parameter using the Integer basic type registered with the current persistence unit.

      Pass the TypeConfiguration associated with the current SQL AST translation request. The configuration is used only to resolve the type and is not retained.

    • queryLimit

      @Nonnull public static JdbcParameter queryLimit(@Nonnull BasicType<Integer> integerType)

      Create a query-limit parameter using the given persistence-unit-scoped Integer basic type.

      The parameter binds the maximum-row value from the original query options, or Integer.MAX_VALUE when no maximum is specified.

    • queryOffset

      @Nonnull public static JdbcParameter queryOffset(@Nonnull TypeConfiguration typeConfiguration)

      Create a query-offset parameter using the Integer basic type registered with the current persistence unit.

      Pass the TypeConfiguration associated with the current SQL AST translation request. The configuration is used only to resolve the type and is not retained.

    • queryOffset

      @Nonnull public static JdbcParameter queryOffset(@Nonnull BasicType<Integer> integerType)

      Create a query-offset parameter using the given persistence-unit-scoped Integer basic type.

      The parameter binds the first-row value from the original query options, or 0 when no offset is specified.

    • custom

      @Nonnull public static JdbcParameter custom(@Nonnull JdbcMapping jdbcMapping, @Nonnull JdbcParameterBinder binder)

      Create a parameter expression with provider-defined binding behavior.

      The returned parameter uses jdbcMapping as its expression mapping and returns binder from JdbcParameter.getParameterBinder(). Its parameter identifier is null.