Annotation Interface Fetch


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface Fetch
Hint to drivers to use the given fetch size for streaming repository methods. - For JDBC: applied to methods returning java.util.stream.Stream<T>, it will call PreparedStatement#setFetchSize(int). - For R2DBC: applied to methods returning reactor.core.publisher.Flux<T>, it will call io.r2dbc.spi.Statement#fetchSize(int). - For Hibernate: applied to methods returning java.util.stream.Stream<T>. Implementations may ignore the hint if unsupported by the underlying driver.
Since:
5.0
Author:
radovanradic
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Will be used in streaming operations if method is not Fetch annotated.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    The desired fetch size to use for streaming operations.
  • Field Details

    • DEFAULT_FETCH_SIZE

      static final int DEFAULT_FETCH_SIZE
      Will be used in streaming operations if method is not Fetch annotated.
      See Also:
  • Element Details

    • value

      int value
      The desired fetch size to use for streaming operations.
      Returns:
      the fetch size (must be > 0 to take effect)