Class JooqHelper$


  • public class JooqHelper$
    extends java.lang.Object
    A java helper wrapping few of the Jooq operations. JOOQ is a library that provides the mechanism to communicate with Database server. To know in detail about Jooq please refer {@link https://www.jooq.org/learn/}.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static JooqHelper$ MODULE$
      Static reference to the singleton instance of this Scala object.
    • Constructor Summary

      Constructors 
      Constructor Description
      JooqHelper$()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.concurrent.CompletableFuture<int[]> executeBatch​(org.jooq.Queries queries)
      Executes the batch of queries asynchronously.
      <R> java.util.concurrent.CompletableFuture<java.util.List<R>> fetchAsync​(org.jooq.ResultQuery<org.jooq.Record> query, java.lang.Class<R> klass)
      Fetches the result in a CompletableFuture.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MODULE$

        public static final JooqHelper$ MODULE$
        Static reference to the singleton instance of this Scala object.
    • Constructor Detail

      • JooqHelper$

        public JooqHelper$()
    • Method Detail

      • executeBatch

        public java.util.concurrent.CompletableFuture<int[]> executeBatch​(org.jooq.Queries queries)
        Executes the batch of queries asynchronously. It wraps the Jooq's DSLContext#executeBatch() in a CompletableFuture and sends the entire batch of queries to database server for execution.

        Parameters:
        queries - A Jooq type that represents a set of queries to execute in batch
        Returns:
        A completable future that completes with an array of integers. The integer, if it is greater than or equal to zero, indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution.
      • fetchAsync

        public <R> java.util.concurrent.CompletableFuture<java.util.List<R>> fetchAsync​(org.jooq.ResultQuery<org.jooq.Record> query,
                                                                                        java.lang.Class<R> klass)
        Fetches the result in a CompletableFuture. It is a wrapper on Jooq's ResultQuery#fetchAsync().

        Parameters:
        query - the select query to fetch the data from database
        klass - the class of type 'R' used to cast the result data
        Returns:
        a CompletableFuture that completes with a list of data 'R'