Package csw.database.javadsl
Class JooqHelper
- java.lang.Object
-
- csw.database.javadsl.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/}.
-
-
Constructor Summary
Constructors Constructor Description JooqHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.CompletableFuture<int[]>
executeBatch(org.jooq.Queries queries)
Executes the batch of queries asynchronously.static <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.
-
-
-
Method Detail
-
executeBatch
public static 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 static <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 databaseklass
- the class of type'R'
used to cast the result data- Returns:
- a CompletableFuture that completes with a list of data
'R'
-
-