- All Superinterfaces:
Attachable
,AttachableQueryPart
,Fields
,Flow.Publisher<R>
,Iterable<R>
,Publisher<R>
,org.reactivestreams.Publisher<R>
,Query
,QueryPart
,Serializable
,Statement
- All Known Subinterfaces:
CloseableResultQuery<R>
,DeleteResultStep<R>
,InsertResultStep<R>
,QOM.DeleteReturning<R>
,QOM.InsertReturning<R>
,QOM.UpdateReturning<R>
,Select<R>
,SelectConditionStep<R>
,SelectConnectByAfterStartWithConditionStep<R>
,SelectConnectByConditionStep<R>
,SelectConnectByStep<R>
,SelectCorrelatedSubqueryStep<R>
,SelectDistinctOnStep<R>
,SelectFinalStep<R>
,SelectForJSONCommonDirectivesStep<R>
,SelectForStep<R>
,SelectForUpdateOfStep<R>
,SelectForUpdateStep<R>
,SelectForUpdateWaitStep<R>
,SelectForXMLCommonDirectivesStep<R>
,SelectForXMLPathDirectivesStep<R>
,SelectForXMLRawDirectivesStep<R>
,SelectFromStep<R>
,SelectGroupByStep<R>
,SelectHavingConditionStep<R>
,SelectHavingStep<R>
,SelectIntoStep<R>
,SelectJoinStep<R>
,SelectLimitAfterOffsetStep<R>
,SelectLimitPercentAfterOffsetStep<R>
,SelectLimitPercentStep<R>
,SelectLimitStep<R>
,SelectOffsetStep<R>
,SelectOnConditionStep<R>
,SelectOptionalOnStep<R>
,SelectOptionStep<R>
,SelectOrderByStep<R>
,SelectQualifyConditionStep<R>
,SelectQualifyStep<R>
,SelectQuery<R>
,SelectSeekLimitStep<R>
,SelectSeekStep1<R,
,T1> SelectSeekStep10<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> SelectSeekStep11<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> SelectSeekStep12<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> SelectSeekStep13<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> SelectSeekStep14<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> SelectSeekStep15<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> SelectSeekStep16<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> SelectSeekStep17<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> SelectSeekStep18<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> SelectSeekStep19<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> SelectSeekStep2<R,
,T1, T2> SelectSeekStep20<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> SelectSeekStep21<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> SelectSeekStep22<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> SelectSeekStep3<R,
,T1, T2, T3> SelectSeekStep4<R,
,T1, T2, T3, T4> SelectSeekStep5<R,
,T1, T2, T3, T4, T5> SelectSeekStep6<R,
,T1, T2, T3, T4, T5, T6> SelectSeekStep7<R,
,T1, T2, T3, T4, T5, T6, T7> SelectSeekStep8<R,
,T1, T2, T3, T4, T5, T6, T7, T8> SelectSeekStep9<R,
,T1, T2, T3, T4, T5, T6, T7, T8, T9> SelectSeekStepN<R>
,SelectSelectStep<R>
,SelectStartWithStep<R>
,SelectUnionStep<R>
,SelectWhereStep<R>
,SelectWindowStep<R>
,SelectWithTiesAfterOffsetStep<R>
,SelectWithTiesStep<R>
,UpdateResultStep<R>
jOOQ distinguishes between ordinary Query
types, such as
Insert
, Update
, Delete
, and any DDLQuery
,
which are meant to produce side effects in a database, and the
ResultQuery
, which is meant to produce a Result
through
various means.
The most common way to create a result is by calling fetch()
, or by
using the query's iterator()
method in a foreach loop:
Result<TRecord> result = ctx.select(T.A, T.B).from(T).fetch();
for (TRecord record : ctx.select(T.A, T.B).from(T)) {
// ...
}
Most approaches to fetching results in ResultQuery
(including the
above), fetch the entire JDBC ResultSet
eagerly into memory, which
allows for closing the underlying JDBC resources as quickly as possible. Such
operations are not resourceful, i.e. users do not need to worry about closing
any resources. None of the many ways of fetching data will affect the SQL
query projection (SELECT
clause). Hence, users must make sure
not to fetch any unnecessary columns, themselves.
There are, however, some ways of fetching results lazily, and thus in a resourceful way. These include:
fetchLazy()
and related methods, which produce aCursor
for imperative style consumption of resulting records.fetchStream()
and related methods, which produce a JavaStream
for functional style consumption of resulting records.
In both cases, it is recommended to explicitly close the underlying resources
(i.e. JDBC ResultSet
) using try-with-resources
:
try (Cursor<TRecord> cursor = ctx.select(T.A, T.B).from(T).fetchLazy()) {
for (;;) {
TRecord record = cursor.fetchNext();
if (record == null)
break;
// ...
}
}
try (Stream<TRecord> stream = ctx.select(T.A, T.B).from(T).fetchStream()) {
stream.forEach(record -> {
// ...
});
}
While most instances of ResultQuery
implement Select
, there
also exist other types of ResultQuery
constructed e.g. from plain SQL
APIs, such as DSLContext.resultQuery(String)
.
- Author:
- Lukas Eder
-
Method Summary
Modifier and TypeMethodDescription@NotNull ResultQuery
<R> Bind a new value to an indexed parameter.@NotNull ResultQuery
<R> Bind a new value to a named parameter.@NotNull ResultQuery
<Record> coerce
(Collection<? extends Field<?>> fields) Coerce the result record type of this query to that of a set of fields.@NotNull ResultQuery
<Record> Coerce the result record type of this query to that of a set of fields.<T1> @NotNull ResultQuery
<Record1<T1>> Coerce the result record type of this query to that of a set of fields.<T1,
T2> @NotNull ResultQuery <Record2<T1, T2>> Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3>
@NotNull ResultQuery<Record3<T1, T2, T3>> Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4>
@NotNull ResultQuery<Record4<T1, T2, T3, T4>> Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5>
@NotNull ResultQuery<Record5<T1, T2, T3, T4, T5>> Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6>
@NotNull ResultQuery<Record6<T1, T2, T3, T4, T5, T6>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7>
@NotNull ResultQuery<Record7<T1, T2, T3, T4, T5, T6, T7>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8>
@NotNull ResultQuery<Record8<T1, T2, T3, T4, T5, T6, T7, T8>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9>
@NotNull ResultQuery<Record9<T1, T2, T3, T4, T5, T6, T7, T8, T9>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10>
@NotNull ResultQuery<Record10<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
@NotNull ResultQuery<Record11<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>
@NotNull ResultQuery<Record12<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>
@NotNull ResultQuery<Record13<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>
@NotNull ResultQuery<Record14<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>
@NotNull ResultQuery<Record15<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>
@NotNull ResultQuery<Record16<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>
@NotNull ResultQuery<Record17<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>
@NotNull ResultQuery<Record18<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>
@NotNull ResultQuery<Record19<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>
@NotNull ResultQuery<Record20<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>
@NotNull ResultQuery<Record21<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20, Field<T21> field21) Coerce the result record type of this query to that of a set of fields.<T1,
T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>
@NotNull ResultQuery<Record22<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>> coerce
(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20, Field<T21> field21, Field<T22> field22) Coerce the result record type of this query to that of a set of fields.<X extends Record>
@NotNull ResultQuery<X> Coerce the result record type of this query to that of a table.<X,
A> X Reduce the execution results of this query using aCollector
.fetch()
Execute the query and return the generated result.@NotNull List
<?> fetch
(int fieldIndex) Execute the query and return all values for a field index from the generated result.<U> @NotNull List
<U> Execute the query and return all values for a field index from the generated result.<U> @NotNull List
<U> Execute the query and return all values for a field index from the generated result.@NotNull List
<?> Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull List
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull List
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull List
<U> Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.<T> @NotNull List
<T> Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.<T,
U> @NotNull List <U> Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.@NotNull List
<?> Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<U> @NotNull List
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<U> @NotNull List
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<E> @NotNull List
<E> fetch
(RecordMapper<? super R, E> mapper) Fetch results into a custom mapper callback.fetchAny()
Execute the query and return at most one resulting record.@Nullable Object
fetchAny
(int fieldIndex) Execute the query and return at most one resulting value for a field index from the generated result.<U> U
Execute the query and return at most one resulting value for a field index from the generated result.<U> U
Execute the query and return at most one resulting value for a field index from the generated result.@Nullable Object
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T> T
Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T,
U> U Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.@Nullable Object
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<E> E
fetchAny
(RecordMapper<? super R, E> mapper) Execute the query and return at most one resulting record.@Nullable Object @Nullable []
Execute the query and return at most one resulting record as an array<E> E
fetchAnyInto
(Class<? extends E> type) Map resulting records onto a custom type.<Z extends Record>
ZfetchAnyInto
(Table<Z> table) Map resulting records onto a custom record.Execute the query and return at most one resulting record as a name/value map.R @NotNull []
Execute the query and return the generated result as an array of records.@Nullable Object @NotNull []
fetchArray
(int fieldIndex) Execute the query and return all values for a field index from the generated result.<U> U @NotNull []
fetchArray
(int fieldIndex, Class<? extends U> type) Execute the query and return all values for a field index from the generated result.<U> U @NotNull []
fetchArray
(int fieldIndex, Converter<?, ? extends U> converter) Execute the query and return all values for a field index from the generated result.@Nullable Object @NotNull []
fetchArray
(String fieldName) Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> U @NotNull []
fetchArray
(String fieldName, Class<? extends U> type) Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> U @NotNull []
fetchArray
(String fieldName, Converter<?, ? extends U> converter) Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> U @NotNull []
fetchArray
(Field<?> field, Class<? extends U> type) Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.<T> T @NotNull []
fetchArray
(Field<T> field) Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.<T,
U> U @NotNull [] fetchArray
(Field<T> field, Converter<? super T, ? extends U> converter) Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.@Nullable Object @NotNull []
fetchArray
(Name fieldName) Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U @NotNull []
fetchArray
(Name fieldName, Class<? extends U> type) Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U @NotNull []
fetchArray
(Name fieldName, Converter<?, ? extends U> converter) Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.@Nullable Object @NotNull [] @NotNull []
Execute the query and return the generated result as an Object matrix.@NotNull CompletionStage
<Result<R>> Fetch results in a newCompletionStage
.@NotNull CompletionStage
<Result<R>> fetchAsync
(Executor executor) Fetch results in a newCompletionStage
that is asynchronously completed by a task running in the given executor.fetchGroups
(int keyFieldIndex) Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value.fetchGroups
(int[] keyFieldIndexes) Execute the query and return aMap
with the result grouped by the given keys.fetchGroups
(int[] keyFieldIndexes, int[] valueFieldIndexes) Execute the query and return aMap
with the result grouped by the given keys.fetchGroups
(int[] keyFieldIndexes, Class<? extends E> type) Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type.fetchGroups
(int[] keyFieldIndexes, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper.fetchGroups
(int keyFieldIndex, int valueFieldIndex) Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value.fetchGroups
(int keyFieldIndex, Class<? extends E> type) Return aMap
with results grouped by the given key and mapped into the given entity type.fetchGroups
(int keyFieldIndex, RecordMapper<? super R, E> mapper) Return aMap
with results grouped by the given key and mapped by the given mapper.fetchGroups
(Class<? extends K> keyType) Execute the query and return aMap
with results grouped by the given key entity.fetchGroups
(Class<? extends K> keyType, Class<? extends V> valueType) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.fetchGroups
(Class<? extends K> keyType, RecordMapper<? super R, V> valueMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.fetchGroups
(String keyFieldName) Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value, usingFields.field(String)
for lookup.fetchGroups
(String[] keyFieldNames) Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(String)
for lookup.fetchGroups
(String[] keyFieldNames, Class<? extends E> type) Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(String)
for lookup.fetchGroups
(String[] keyFieldNames, String[] valueFieldNames) Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(String)
for lookup.fetchGroups
(String[] keyFieldNames, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(String)
for lookup.fetchGroups
(String keyFieldName, Class<? extends E> type) Return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(String)
for lookup.fetchGroups
(String keyFieldName, String valueFieldName) Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(String)
for lookup.fetchGroups
(String keyFieldName, RecordMapper<? super R, E> mapper) Return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(String)
for lookup.fetchGroups
(Field<?>[] keys) Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Field)
for lookup.fetchGroups
(Field<?>[] keys, Class<? extends E> type) Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Field)
for lookup.fetchGroups
(Field<?>[] keys, Field<?>[] values) Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Field)
for lookup.fetchGroups
(Field<?>[] keys, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Field)
for lookup.fetchGroups
(Field<K> key) Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value, usingFields.field(Field)
for lookup.fetchGroups
(Field<K> key, Class<? extends E> type) Return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Field)
for lookup.fetchGroups
(Field<K> key, Field<V> value) Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Field)
for lookup.fetchGroups
(Field<K> key, RecordMapper<? super R, E> mapper) Return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Field)
for lookup.fetchGroups
(Name keyFieldName) Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value, usingFields.field(Name)
for lookup.fetchGroups
(Name[] keyFieldNames) Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Name)
for lookup.fetchGroups
(Name[] keyFieldNames, Class<? extends E> type) Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Name)
for lookup.fetchGroups
(Name[] keyFieldNames, Name[] valueFieldNames) Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Name)
for lookup.fetchGroups
(Name[] keyFieldNames, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Name)
for lookup.fetchGroups
(Name keyFieldName, Class<? extends E> type) Return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Name)
for lookup.fetchGroups
(Name keyFieldName, Name valueFieldName) Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Name)
for lookup.fetchGroups
(Name keyFieldName, RecordMapper<? super R, E> mapper) Return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Name)
for lookup.fetchGroups
(RecordMapper<? super R, K> keyMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.fetchGroups
(RecordMapper<? super R, K> keyMapper, Class<V> valueType) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.fetchGroups
(RecordMapper<? super R, K> keyMapper, RecordMapper<? super R, V> valueMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.fetchGroups
(Table<S> table) Execute the query and return aMap
with the result grouped by the given table.fetchGroups
(Table<S> table, Class<? extends E> type) Execute the query and return aMap
with results grouped by the given table and mapped into the given entity type.fetchGroups
(Table<S> table, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given table and mapped by the given mapper.fetchGroups
(Table<S> keyTable, Table<T> valueTable) Execute the query and return aMap
with the result grouped by the given table.<H extends RecordHandler<? super R>>
HfetchInto
(H handler) Deprecated, for removal: This API element is subject to removal in a future version.<E> @NotNull List
<E> Map resulting records onto a custom type.Map resulting records onto a custom record.Execute the query and "lazily" return the generated result.@NotNull Results
Execute a query, possibly returning several result sets.fetchMap
(int keyFieldIndex) Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value.fetchMap
(int[] keyFieldIndexes) Execute the query and return aMap
with keys as a map key and the corresponding record as value.fetchMap
(int[] keyFieldIndexes, int[] valueFieldIndexes) Execute the query and return aMap
with keys as a map key and the corresponding record as value.Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type.fetchMap
(int[] keyFieldIndexes, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper.@NotNull Map
<?, ?> fetchMap
(int keyFieldIndex, int valueFieldIndex) Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value.<E> @NotNull Map
<?, E> Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type.<E> @NotNull Map
<?, E> fetchMap
(int keyFieldIndex, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given key and mapped by the given mapper.Execute the query and return aMap
with results grouped by the given key entity.<K,
V> @NotNull Map <K, V> Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.<K,
V> @NotNull Map <K, V> fetchMap
(Class<? extends K> keyType, RecordMapper<? super R, V> valueMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value, usingFields.field(String)
for lookup.Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(String)
for lookup.Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(String)
for lookup.Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(String)
for lookup.fetchMap
(String[] keyFieldNames, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(String)
for lookup.<E> @NotNull Map
<?, E> Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(String)
for lookup.@NotNull Map
<?, ?> Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(String)
for lookup.<E> @NotNull Map
<?, E> fetchMap
(String keyFieldName, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(String)
for lookup.Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Field)
for lookup.Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Field)
for lookup.Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Field)
for lookup.fetchMap
(Field<?>[] keys, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Field)
for lookup.Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value, usingFields.field(Field)
for lookup.<K,
E> @NotNull Map <K, E> Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Field)
for lookup.<K,
V> @NotNull Map <K, V> Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Field)
for lookup.<K,
E> @NotNull Map <K, E> fetchMap
(Field<K> key, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Field)
for lookup.Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value, usingFields.field(Name)
for lookup.Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Name)
for lookup.Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Name)
for lookup.Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Name)
for lookup.fetchMap
(Name[] keyFieldNames, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Name)
for lookup.<E> @NotNull Map
<?, E> Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Name)
for lookup.@NotNull Map
<?, ?> Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Name)
for lookup.<E> @NotNull Map
<?, E> fetchMap
(Name keyFieldName, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Name)
for lookup.fetchMap
(RecordMapper<? super R, K> keyMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.<K,
V> @NotNull Map <K, V> fetchMap
(RecordMapper<? super R, K> keyMapper, Class<V> valueType) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.<K,
V> @NotNull Map <K, V> fetchMap
(RecordMapper<? super R, K> keyMapper, RecordMapper<? super R, V> valueMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.Execute the query and return aMap
with table as a map key and the corresponding record as value.Execute the query and return aMap
with results grouped by the given table and mapped into the given entity type.fetchMap
(Table<S> table, RecordMapper<? super R, E> mapper) Execute the query and return aMap
with results grouped by the given table and mapped by the given mapper.Execute the query and return aMap
with table as a map key and the corresponding record as value.Execute the query and return the generated result as a list of name/value maps.fetchOne()
Execute the query and return at most one resulting record.@Nullable Object
fetchOne
(int fieldIndex) Execute the query and return at most one resulting value for a field index from the generated result.<U> U
Execute the query and return at most one resulting value for a field index from the generated result.<U> U
Execute the query and return at most one resulting value for a field index from the generated result.@Nullable Object
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T> T
Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T,
U> U Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.@Nullable Object
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<E> E
fetchOne
(RecordMapper<? super R, E> mapper) Execute the query and return at most one resulting value into a custom mapper callback.@Nullable Object @Nullable []
Execute the query and return at most one resulting record as an array<E> E
fetchOneInto
(Class<? extends E> type) Map resulting records onto a custom type.<Z extends Record>
ZfetchOneInto
(Table<Z> table) Map resulting records onto a custom record.Execute the query and return at most one resulting record as a name/value map.Execute the query and return at most one resulting record.@NotNull Optional
<?> fetchOptional
(int fieldIndex) Execute the query and return at most one resulting value for a field index from the generated result.<U> @NotNull Optional
<U> fetchOptional
(int fieldIndex, Class<? extends U> type) Execute the query and return at most one resulting value for a field index from the generated result.<U> @NotNull Optional
<U> fetchOptional
(int fieldIndex, Converter<?, ? extends U> converter) Execute the query and return at most one resulting value for a field index from the generated result.@NotNull Optional
<?> fetchOptional
(String fieldName) Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull Optional
<U> fetchOptional
(String fieldName, Class<? extends U> type) Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull Optional
<U> fetchOptional
(String fieldName, Converter<?, ? extends U> converter) Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull Optional
<U> fetchOptional
(Field<?> field, Class<? extends U> type) Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T> @NotNull Optional
<T> fetchOptional
(Field<T> field) Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T,
U> @NotNull Optional <U> fetchOptional
(Field<T> field, Converter<? super T, ? extends U> converter) Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.@NotNull Optional
<?> fetchOptional
(Name fieldName) Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> @NotNull Optional
<U> fetchOptional
(Name fieldName, Class<? extends U> type) Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> @NotNull Optional
<U> fetchOptional
(Name fieldName, Converter<?, ? extends U> converter) Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<E> @NotNull Optional
<E> fetchOptional
(RecordMapper<? super R, E> mapper) Execute the query and return at most one resulting value into a custom mapper callback.Execute the query and return at most one resulting record as an array.<E> @NotNull Optional
<E> fetchOptionalInto
(Class<? extends E> type) Map resulting records onto a custom type.fetchOptionalInto
(Table<Z> table) Map resulting records onto a custom record.Execute the query and return at most one resulting record as a name/value map.@NotNull ResultSet
Execute the query and return the generated result as a JDBCResultSet
.@NotNull Set
<?> fetchSet
(int fieldIndex) Execute the query and return all values for a field index from the generated result.<U> @NotNull Set
<U> Execute the query and return all values for a field index from the generated result.<U> @NotNull Set
<U> Execute the query and return all values for a field index from the generated result.@NotNull Set
<?> Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull Set
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull Set
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.<U> @NotNull Set
<U> Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.<T> @NotNull Set
<T> Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.<T,
U> @NotNull Set <U> Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.@NotNull Set
<?> Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<U> @NotNull Set
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<U> @NotNull Set
<U> Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.<E> @NotNull Set
<E> fetchSet
(RecordMapper<? super R, E> mapper) Fetch results into a custom mapper callback.Execute the query and return exactly one resulting record.@Nullable Object
fetchSingle
(int fieldIndex) Execute the query and return exactly one resulting value for a field index from the generated result.<U> U
fetchSingle
(int fieldIndex, Class<? extends U> type) Execute the query and return exactly one resulting value for a field index from the generated result.<U> U
fetchSingle
(int fieldIndex, Converter<?, ? extends U> converter) Execute the query and return exactly one resulting value for a field index from the generated result.@Nullable Object
fetchSingle
(String fieldName) Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
fetchSingle
(String fieldName, Class<? extends U> type) Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
fetchSingle
(String fieldName, Converter<?, ? extends U> converter) Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.<U> U
fetchSingle
(Field<?> field, Class<? extends U> type) Execute the query and return exactly one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T> T
fetchSingle
(Field<T> field) Execute the query and return exactly one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.<T,
U> U fetchSingle
(Field<T> field, Converter<? super T, ? extends U> converter) Execute the query and return exactly one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.@Nullable Object
fetchSingle
(Name fieldName) Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U
fetchSingle
(Name fieldName, Class<? extends U> type) Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<U> U
fetchSingle
(Name fieldName, Converter<?, ? extends U> converter) Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.<E> E
fetchSingle
(RecordMapper<? super R, E> mapper) Execute the query and return exactly one resulting value into a custom mapper callback.@Nullable Object @NotNull []
Execute the query and return exactly one resulting record as an array<E> E
fetchSingleInto
(Class<? extends E> type) Map resulting records onto a custom type.<Z extends Record>
ZfetchSingleInto
(Table<Z> table) Map resulting records onto a custom record.Execute the query and return exactly one resulting record as a name/value map.@NotNull ResultQuery
<R> fetchSize
(int rows) Specify the fetch size of the underlyingStatement
.Stream this query.<E> @NotNull Stream
<E> fetchStreamInto
(Class<? extends E> type) Stream this query, mapping records into a custom type.fetchStreamInto
(Table<Z> table) Stream this query, mapping records into a custom record.default void
Execute the query and consume its results.The record type produced by this query.Return the result generated by a previous call to execute().@NotNull ResultQuery
<R> intern
(int... fieldIndexes) Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0@NotNull ResultQuery
<R> Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0@NotNull ResultQuery
<R> Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0@NotNull ResultQuery
<R> Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0iterator()
@NotNull CloseableResultQuery
<R> keepStatement
(boolean keepStatement) Keep the query's underlying statement open after execution.@NotNull ResultQuery
<R> maxRows
(int rows) Specify the maximum number of rows returned by the underlyingStatement
.@NotNull ResultQuery
<R> poolable
(boolean poolable) Specify whether any JDBCStatement
created by this query should beStatement.setPoolable(boolean)
.@NotNull ResultQuery
<R> queryTimeout
(int timeout) Specify the query timeout in number of seconds for the underlying JDBCStatement
.@NotNull ResultQuery
<R> resultSetConcurrency
(int resultSetConcurrency) Specify theResultSet
concurrency ofResultSet
objects created by jOOQ.@NotNull ResultQuery
<R> resultSetHoldability
(int resultSetHoldability) Specify theResultSet
holdability ofResultSet
objects created by jOOQ.@NotNull ResultQuery
<R> resultSetType
(int resultSetType) Specify theResultSet
type ofResultSet
objects created by jOOQ.default @NotNull Spliterator
<R> Execute the query usingfetch()
and return the generated result as anSpliterator
.stream()
Stream this query.Methods inherited from interface org.jooq.Attachable
attach, configuration, detach
Methods inherited from interface org.jooq.AttachableQueryPart
getBindValues, getParam, getParams, getSQL, getSQL
Methods inherited from interface org.jooq.Fields
dataType, dataType, dataType, dataTypes, field, field, field, field, field, field, field, field, field, field, fields, fields, fields, fields, fields, fieldsRow, fieldStream, indexOf, indexOf, indexOf, type, type, type, types
Methods inherited from interface org.reactivestreams.Publisher
subscribe
Methods inherited from interface org.jooq.Query
cancel, execute, executeAsync, executeAsync, isExecutable
-
Method Details
-
fetch
Execute the query and return the generated result.The result and its contained records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Lifecycle guarantees
This method completes the wholeConnectionProvider
andExecuteListener
lifecycles, eagerly fetching all results into memory. Underlying JDBCResultSet
s are always closed. Underlying JDBCPreparedStatement
s are closed, unlesskeepStatement(boolean)
is set.In order to keep open
ResultSet
s and fetch records lazily, usefetchLazy()
instead and then operate onCursor
.This method is not affected by
Settings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchResultSet
Execute the query and return the generated result as a JDBCResultSet
.This is the same as calling
fetchLazy()
.resultSet()
and will return aResultSet
wrapping the JDBC driver'sResultSet
. Closing thisResultSet
may close the producingStatement
orPreparedStatement
, depending on your setting forkeepStatement(boolean)
.You can use this method when you want to use jOOQ for query execution, but not for result fetching. The returned
ResultSet
can also be used withDSLContext.fetch(ResultSet)
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
iterator
- Specified by:
iterator
in interfaceIterable<R extends Record>
- Throws:
DataAccessException
-
spliterator
- Specified by:
spliterator
in interfaceIterable<R extends Record>
-
forEach
Execute the query and consume its results. -
fetchStream
Stream this query.This is just a synonym for
stream()
.Clients should ensure the
Stream
is properly closed, e.g. in a try-with-resources statement:try (Stream<R> stream = query.stream()) { // Do things with stream }
If users prefer more fluent style streaming of queries,
ResultSet
can be registered and closed viaExecuteListener
, or via "smart" third-partyDataSource
s.Depending on your JDBC driver's default behaviour, this may load the whole database result into the driver's memory. In order to indicate to the driver that you may not want to fetch all records at once, use
fetchSize(int)
orSettings.setFetchSize(Integer)
prior to calling this method.- Returns:
- The result.
- Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchStreamInto
@NotNull @Blocking <E> @NotNull Stream<E> fetchStreamInto(Class<? extends E> type) throws DataAccessException, MappingException Stream this query, mapping records into a custom type.This is the same as calling
fetchStream().map(r -> r.into(type))
. SeeRecord.into(Class)
for more details.Clients should ensure the
Stream
is properly closed, e.g. in a try-with-resources statement:try (Stream<R> stream = query.stream()) { // Do things with stream }
If users prefer more fluent style streaming of queries,
ResultSet
can be registered and closed viaExecuteListener
, or via "smart" third-partyDataSource
s.Depending on your JDBC driver's default behaviour, this may load the whole database result into the driver's memory. In order to indicate to the driver that you may not want to fetch all records at once, use
fetchSize(int)
orSettings.setFetchSize(Integer)
prior to calling this method.- Type Parameters:
E
- The generic entity type.- Parameters:
type
- The entity type.- Returns:
- The results.
- Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchStreamInto
@NotNull @Blocking <Z extends Record> @NotNull Stream<Z> fetchStreamInto(Table<Z> table) throws DataAccessException Stream this query, mapping records into a custom record.This is the same as calling
fetchStream().map(r -> r.into(table))
. SeeRecord.into(Table)
for more details.The result and its contained records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Clients should ensure the
Stream
is properly closed, e.g. in a try-with-resources statement:try (Stream<R> stream = query.stream()) { // Do things with stream }
If users prefer more fluent style streaming of queries,
ResultSet
can be registered and closed viaExecuteListener
, or via "smart" third-partyDataSource
s.Depending on your JDBC driver's default behaviour, this may load the whole database result into the driver's memory. In order to indicate to the driver that you may not want to fetch all records at once, use
fetchSize(int)
orSettings.setFetchSize(Integer)
prior to calling this method.- Type Parameters:
Z
- The generic table record type.- Parameters:
table
- The table type.- Returns:
- The results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
stream
Stream this query.This is essentially the same as
fetchLazy()
but instead of returning aCursor
, a Java 8Stream
is returned. Clients should ensure theStream
is properly closed, e.g. in a try-with-resources statement:try (Stream<R> stream = query.stream()) { // Do things with stream }
If users prefer more fluent style streaming of queries,
ResultSet
can be registered and closed viaExecuteListener
, or via "smart" third-partyDataSource
s.Depending on your JDBC driver's default behaviour, this may load the whole database result into the driver's memory. In order to indicate to the driver that you may not want to fetch all records at once, use
fetchSize(int)
orSettings.setFetchSize(Integer)
prior to calling this method.- Returns:
- The result.
- Throws:
DataAccessException
- if something went wrong executing the query
-
collect
Reduce the execution results of this query using aCollector
.This works in the same way as calling the following code:
try (Stream<R> stream = resultQuery.stream()) { X result = stream.collect(collector); }
collect()
method.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Parameters:
collector
- The collector that collects all records and accumulates them into a result type.- Returns:
- The result of the collection.
- Throws:
DataAccessException
- if something went wrong executing the query
-
fetchLazy
Execute the query and "lazily" return the generated result.The returned
Cursor
holds a reference to the executedPreparedStatement
and the associatedResultSet
. Data can be fetched (or iterated over) lazily, fetching records from theResultSet
one by one.Depending on your JDBC driver's default behaviour, this may load the whole database result into the driver's memory. In order to indicate to the driver that you may not want to fetch all records at once, use
fetchSize(int)
orSettings.setFetchSize(Integer)
prior to calling this method.Client code is responsible for closing the cursor after use.
- Returns:
- The resulting cursor. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchMany
Execute a query, possibly returning several result sets.Example (Sybase ASE):
String sql = "sp_help 'my_table'";
The result and its contained records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Returns:
- The resulting records. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetch
Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(Field)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.If the argument
Field
is the same as the one you've provided toDSLContext.select(SelectField)
, then you could also just callcollect(Collector)
withRecords.intoList()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetch
@NotNull @Blocking <U> @NotNull List<U> fetch(Field<?> field, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(Field, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetch
@NotNull @Blocking <T,U> @NotNull List<U> fetch(Field<T> field, Converter<? super T, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(Field, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetch
Execute the query and return all values for a field index from the generated result.This is the same as calling
fetch()
and thenResult.getValues(int)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetch
@NotNull @Blocking <U> @NotNull List<U> fetch(int fieldIndex, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field index from the generated result.This is the same as calling
fetch()
and thenResult.getValues(int, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetch
@NotNull @Blocking <U> @NotNull List<U> fetch(int fieldIndex, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field index from the generated result.This is the same as calling
fetch()
and thenResult.getValues(int, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetch
Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(String)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetch
@NotNull @Blocking <U> @NotNull List<U> fetch(String fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(String, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetch
@NotNull @Blocking <U> @NotNull List<U> fetch(String fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(String, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetch
Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(Name)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetch
@NotNull @Blocking <U> @NotNull List<U> fetch(Name fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(Name, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetch
@NotNull @Blocking <U> @NotNull List<U> fetch(Name fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetch()
and thenResult.getValues(Name, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchOne
Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(Field)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <U> U fetchOne(Field<?> field, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(Field, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <T,U> U fetchOne(Field<T> field, Converter<? super T, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(Field, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking @Nullable Object fetchOne(int fieldIndex) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchOne()
and thenRecord.get(int)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <U> U fetchOne(int fieldIndex, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchOne()
and thenRecord.get(int, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <U> U fetchOne(int fieldIndex, Converter<?, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchOne()
and thenRecord.get(int, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking @Nullable Object fetchOne(String fieldName) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(String)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <U> U fetchOne(String fieldName, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(String, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <U> U fetchOne(String fieldName, Converter<?, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(String, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking @Nullable Object fetchOne(Name fieldName) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(Name)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <U> U fetchOne(Name fieldName, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(Name, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <U> U fetchOne(Name fieldName, Converter<?, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchOne()
and thenRecord.get(Name, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
Execute the query and return at most one resulting record.The resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOne
@Nullable @Blocking <E> E fetchOne(RecordMapper<? super R, E> mapper) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value into a custom mapper callback.- Returns:
- The custom mapped record or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOneMap
@Nullable @Blocking @Nullable Map<String,Object> fetchOneMap() throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting record as a name/value map.- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchOneArray
@Nullable @Blocking @Nullable Object @Nullable [] fetchOneArray() throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting record as an arrayYou can access data like this
query.fetchOneArray()[fieldIndex]
- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOneInto
@Nullable @Blocking <E> E fetchOneInto(Class<? extends E> type) throws DataAccessException, MappingException, TooManyRowsException Map resulting records onto a custom type.This is the same as calling
E result = null; Record r = q.fetchOne(); if (r != null) result = r.into(type);
Record.into(Class)
for more details- Type Parameters:
E
- The generic entity type.- Parameters:
type
- The entity type.- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchOneInto
@Nullable @Blocking <Z extends Record> Z fetchOneInto(Table<Z> table) throws DataAccessException, TooManyRowsException Map resulting records onto a custom record.This is the same as calling
Z result = null; Record r = q.fetchOne(); if (r != null) result = r.into(table);
Record.into(Table)
for more detailsThe resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Type Parameters:
Z
- The generic table record type.- Parameters:
table
- The table type.- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchSingle
@Nullable @Blocking <T> T fetchSingle(Field<T> field) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(Field)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <U> U fetchSingle(Field<?> field, Class<? extends U> type) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(Field, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <T,U> U fetchSingle(Field<T> field, Converter<? super T, ? extends U> converter) throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(Field, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking @Nullable Object fetchSingle(int fieldIndex) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field index from the generated result.This is the same as calling
fetchSingle()
and thenRecord.get(int)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <U> U fetchSingle(int fieldIndex, Class<? extends U> type) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field index from the generated result.This is the same as calling
fetchSingle()
and thenRecord.get(int, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <U> U fetchSingle(int fieldIndex, Converter<?, ? extends U> converter) throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting value for a field index from the generated result.This is the same as calling
fetchSingle()
and thenRecord.get(int, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking @Nullable Object fetchSingle(String fieldName) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(String)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <U> U fetchSingle(String fieldName, Class<? extends U> type) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(String, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <U> U fetchSingle(String fieldName, Converter<?, ? extends U> converter) throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(String, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking @Nullable Object fetchSingle(Name fieldName) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(Name)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <U> U fetchSingle(Name fieldName, Class<? extends U> type) throws DataAccessException, NoDataFoundException, TooManyRowsException Execute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(Name, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@Nullable @Blocking <U> U fetchSingle(Name fieldName, Converter<?, ? extends U> converter) throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchSingle()
and thenRecord.get(Name, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value. Unlike other
fetchSingle()
methods, which never producenull
records, this can be null if the resulting value in the record isnull
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@NotNull @Blocking R fetchSingle() throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting record.The resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Returns:
- The resulting value. This is never
null
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingle
@NotNull @Blocking <E> E fetchSingle(RecordMapper<? super R, E> mapper) throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting value into a custom mapper callback.- Returns:
- The resulting value. This is never
null
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingleMap
@NotNull @Blocking @NotNull Map<String,Object> fetchSingleMap() throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting record as a name/value map.- Returns:
- The resulting value. This is never
null
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchSingleArray
@Nullable @Blocking @Nullable Object @NotNull [] fetchSingleArray() throws DataAccessException, NoDataFoundException, TooManyRowsExceptionExecute the query and return exactly one resulting record as an arrayYou can access data like this
query.fetchSingleArray()[fieldIndex]
- Returns:
- The resulting value. This is never
null
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record
-
fetchSingleInto
@Blocking <E> E fetchSingleInto(Class<? extends E> type) throws DataAccessException, MappingException, NoDataFoundException, TooManyRowsException Map resulting records onto a custom type.This is the same as calling
E result = null; Record r = q.fetchSingle(); if (r != null) result = r.into(type);
Record.into(Class)
for more details- Type Parameters:
E
- The generic entity type.- Parameters:
type
- The entity type.- Returns:
- The resulting value.
- Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchSingleInto
@NotNull @Blocking <Z extends Record> Z fetchSingleInto(Table<Z> table) throws DataAccessException, NoDataFoundException, TooManyRowsException Map resulting records onto a custom record.This is the same as calling
Z result = null; Record r = q.fetchSingle(); if (r != null) result = r.into(table);
Record.into(Table)
for more detailsThe resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Type Parameters:
Z
- The generic table record type.- Parameters:
table
- The table type.- Returns:
- The resulting value. This is never
null
. - Throws:
DataAccessException
- if something went wrong executing the queryNoDataFoundException
- if the query returned no recordsTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchOptional
@NotNull @Blocking <T> @NotNull Optional<T> fetchOptional(Field<T> field) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(Field)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <U> @NotNull Optional<U> fetchOptional(Field<?> field, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(Field, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <T,U> @NotNull Optional<U> fetchOptional(Field<T> field, Converter<? super T, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(Field, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking @NotNull Optional<?> fetchOptional(int fieldIndex) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchOptional()
and thenRecord.get(int)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <U> @NotNull Optional<U> fetchOptional(int fieldIndex, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchOptional()
and thenRecord.get(int, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <U> @NotNull Optional<U> fetchOptional(int fieldIndex, Converter<?, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchOptional()
and thenRecord.get(int, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking @NotNull Optional<?> fetchOptional(String fieldName) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(String)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <U> @NotNull Optional<U> fetchOptional(String fieldName, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(String, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <U> @NotNull Optional<U> fetchOptional(String fieldName, Converter<?, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(String, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking @NotNull Optional<?> fetchOptional(Name fieldName) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(Name)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <U> @NotNull Optional<U> fetchOptional(Name fieldName, Class<? extends U> type) throws DataAccessException, TooManyRowsException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(Name, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <U> @NotNull Optional<U> fetchOptional(Name fieldName, Converter<?, ? extends U> converter) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchOptional()
and thenRecord.get(Name, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking @NotNull Optional<R> fetchOptional() throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting record.The resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Returns:
- The resulting record
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptional
@NotNull @Blocking <E> @NotNull Optional<E> fetchOptional(RecordMapper<? super R, E> mapper) throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting value into a custom mapper callback.- Returns:
- The custom mapped record
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptionalMap
@NotNull @Blocking @NotNull Optional<Map<String,Object>> fetchOptionalMap() throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting record as a name/value map.- Returns:
- The resulting record
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchOptionalArray
@NotNull @Blocking @NotNull Optional<Object[]> fetchOptionalArray() throws DataAccessException, TooManyRowsExceptionExecute the query and return at most one resulting record as an array.- Returns:
- The resulting record
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record
-
fetchOptionalInto
@NotNull @Blocking <E> @NotNull Optional<E> fetchOptionalInto(Class<? extends E> type) throws DataAccessException, MappingException, TooManyRowsException Map resulting records onto a custom type.This is the same as calling
Optional<E> result = q.fetchOptional().map(r -> r.into(type));
Record.into(Class)
for more details- Type Parameters:
E
- The generic entity type.- Parameters:
type
- The entity type.- Returns:
- The resulting record
- Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchOptionalInto
@NotNull @Blocking <Z extends Record> @NotNull Optional<Z> fetchOptionalInto(Table<Z> table) throws DataAccessException, TooManyRowsException Map resulting records onto a custom record.This is the same as calling
Optional<Z> result = q.fetchOptional().map(r -> r.into(table));
Record.into(Table)
for more detailsThe resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Type Parameters:
Z
- The generic table record type.- Parameters:
table
- The table type.- Returns:
- The resulting record
- Throws:
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record- See Also:
-
fetchAny
Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(Field)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <U> U fetchAny(Field<?> field, Class<? extends U> type) throws DataAccessException Execute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(Field, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <T,U> U fetchAny(Field<T> field, Converter<? super T, ? extends U> converter) throws DataAccessExceptionExecute the query and return at most one resulting value for a field from the generated result, usingFields.field(Field)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(Field, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
Execute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchAny()
and thenRecord.get(int)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <U> U fetchAny(int fieldIndex, Class<? extends U> type) throws DataAccessException Execute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchAny()
and thenRecord.get(int, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <U> U fetchAny(int fieldIndex, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return at most one resulting value for a field index from the generated result.This is the same as calling
fetchAny()
and thenRecord.get(int, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(String)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <U> U fetchAny(String fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(String, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <U> U fetchAny(String fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return at most one resulting value for a field name from the generated result, usingFields.field(String)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(String, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(Name)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <U> U fetchAny(Name fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(Name, Class)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
@Nullable @Blocking <U> U fetchAny(Name fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return at most one resulting value for a field name from the generated result, usingFields.field(Name)
for lookup.This is the same as calling
fetchAny()
and thenRecord.get(Name, Converter)
. As such, the query projection (SELECT
clause) is not affected. Make sure not to fetch any unnecessary data.- Returns:
- The resulting value or
null
if the query returned no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
Execute the query and return at most one resulting record.The resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Returns:
- The first resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAny
Execute the query and return at most one resulting record.The resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Returns:
- The first resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAnyMap
Execute the query and return at most one resulting record as a name/value map.- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchAnyArray
Execute the query and return at most one resulting record as an arrayYou can access data like this
query.fetchAnyArray()[fieldIndex]
- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAnyInto
@Nullable @Blocking <E> E fetchAnyInto(Class<? extends E> type) throws DataAccessException, MappingException Map resulting records onto a custom type.This is the same as calling
E result = null; Record r = q.fetchAny(); if (r != null) result = r.into(type);
Record.into(Class)
for more details- Type Parameters:
E
- The generic entity type.- Parameters:
type
- The entity type.- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchAnyInto
Map resulting records onto a custom record.This is the same as calling
Z result = null; Record r = q.fetchOne(); if (r != null) result = r.into(table);
Record.into(Table)
for more detailsThe resulting record is attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Type Parameters:
Z
- The generic table record type.- Parameters:
table
- The table type.- Returns:
- The resulting record or
null
if the query returns no records. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchMaps
Execute the query and return the generated result as a list of name/value maps.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value, usingFields.field(Field)
for lookup.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(Field)
instead, if your keys are non-uniqueThe resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Type Parameters:
K
- The key's generic field type- Parameters:
key
- The key field. Client code must assure that this field is unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(int)
instead, if your keys are non-uniqueThe resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key field. Client code must assure that this field is unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value, usingFields.field(String)
for lookup.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(String)
instead, if your keys are non-uniqueThe resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field. Client code must assure that this field is unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
Execute the query and return aMap
with one of the result's columns as key and the corresponding records as value, usingFields.field(Name)
for lookup.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(Name)
instead, if your keys are non-uniqueThe resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field. Client code must assure that this field is unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
@NotNull @Blocking <K,V> @NotNull Map<K,V> fetchMap(Field<K> key, Field<V> value) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Field)
for lookup.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(Field, Field)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
If the argument
Field
s are the same as the ones you've provided toDSLContext.select(SelectField, SelectField)
, then you could also just callcollect(Collector)
withRecords.intoMap()
.- Type Parameters:
K
- The key's generic field typeV
- The value's generic field type- Parameters:
key
- The key field. Client code must assure that this field is unique in the result set.value
- The value field- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<?,?> fetchMap(int keyFieldIndex, int valueFieldIndex) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(int, int)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key field. Client code must assure that this field is unique in the result set.valueFieldIndex
- The value field- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<?,?> fetchMap(String keyFieldName, String valueFieldName) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(String)
for lookup.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(String, String)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field. Client code must assure that this field is unique in the result set.valueFieldName
- The value field- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<?,?> fetchMap(Name keyFieldName, Name valueFieldName) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Name)
for lookup.An exception is thrown, if the key turns out to be non-unique in the result set. Use
fetchGroups(Name, Name)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field. Client code must assure that this field is unique in the result set.valueFieldName
- The value field- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more equal values from the result set.- See Also:
-
fetchMap
Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Field)
for lookup.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(Field[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys. Client code must assure that keys are unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<Record,R> fetchMap(int[] keyFieldIndexes) throws DataAccessException Execute the query and return aMap
with keys as a map key and the corresponding record as value.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(int[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys. Client code must assure that keys are unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<Record,R> fetchMap(String[] keyFieldNames) throws DataAccessException Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(String)
for lookup.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(String[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Name)
for lookup.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(Name[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<Record,Record> fetchMap(Field<?>[] keys, Field<?>[] values) throws DataAccessException Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Field)
for lookup.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(Field[], Field[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys. Client code must assure that keys are unique in the result set.values
- The values.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<Record,Record> fetchMap(int[] keyFieldIndexes, int[] valueFieldIndexes) throws DataAccessException Execute the query and return aMap
with keys as a map key and the corresponding record as value.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(int[], int[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys. Client code must assure that keys are unique in the result set.valueFieldIndexes
- The values.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<Record,Record> fetchMap(String[] keyFieldNames, String[] valueFieldNames) throws DataAccessException Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(String)
for lookup.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(String[], String[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set.valueFieldNames
- The values.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking @NotNull Map<Record,Record> fetchMap(Name[] keyFieldNames, Name[] valueFieldNames) throws DataAccessException Execute the query and return aMap
with keys as a map key and the corresponding record as value, usingFields.field(Name)
for lookup.An exception is thrown, if the keys turn out to be non-unique in the result set. Use
fetchGroups(Name[], Name[])
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set.valueFieldNames
- The values.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(Field<?>[] keys, Class<? extends E> type) throws DataAccessException, MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Field)
for lookup.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Field[], Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(int[] keyFieldIndexes, Class<? extends E> type) throws DataAccessException, MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(int[], Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(String[] keyFieldNames, Class<? extends E> type) throws DataAccessException, MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(String)
for lookup.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(String[], Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(Name[] keyFieldNames, Class<? extends E> type) throws DataAccessException, MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Name)
for lookup.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Name[], Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(Field<?>[] keys, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Field)
for lookup.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Field[], RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(int[] keyFieldIndexes, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(int[], RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(String[] keyFieldNames, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(String)
for lookup.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(String[], RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<List<?>,E> fetchMap(Name[] keyFieldNames, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Name)
for lookup.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Name[], RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. Client code must assure that keys are unique in the result set. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <K> @NotNull Map<K,R> fetchMap(Class<? extends K> keyType) throws DataAccessException, MappingException, InvalidResultException Execute the query and return aMap
with results grouped by the given key entity.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyType
- The key type. If this isnull
, the resulting map will contain at most one entry.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsInvalidResultException
- if the key list is non-unique in the result set.DataAccessException
- See Also:
-
fetchMap
@NotNull @Blocking <K,V> @NotNull Map<K,V> fetchMap(Class<? extends K> keyType, Class<? extends V> valueType) throws DataAccessException, MappingException, InvalidResultException Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Class, Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyType
- The key type. If this isnull
, the resulting map will contain at most one entry.valueType
- The value type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsInvalidResultException
- if the key list is non-unique in the result set.DataAccessException
- See Also:
-
fetchMap
@NotNull @Blocking <K,V> @NotNull Map<K,V> fetchMap(Class<? extends K> keyType, RecordMapper<? super R, V> valueMapper) throws DataAccessException, InvalidResultException, MappingExceptionExecute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Class, RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyType
- The key type. If this isnull
, the resulting map will contain at most one entry.valueMapper
- The value mapper.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsInvalidResultException
- if the key list is non-unique in the result set.DataAccessException
- See Also:
-
fetchMap
@NotNull @Blocking <K> @NotNull Map<K,R> fetchMap(RecordMapper<? super R, K> keyMapper) throws DataAccessException, InvalidResultException, MappingExceptionExecute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyMapper
- The key mapper.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsInvalidResultException
- if the key list is non-unique in the result set.DataAccessException
- See Also:
-
fetchMap
@NotNull @Blocking <K,V> @NotNull Map<K,V> fetchMap(RecordMapper<? super R, K> keyMapper, Class<V> valueType) throws DataAccessException, InvalidResultException, MappingExceptionExecute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(RecordMapper, Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyMapper
- The key mapper.valueType
- The value type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsInvalidResultException
- if the key list is non-unique in the result set.DataAccessException
- See Also:
-
fetchMap
@NotNull @Blocking <K,V> @NotNull Map<K,V> fetchMap(RecordMapper<? super R, K> keyMapper, RecordMapper<? super R, throws DataAccessException, InvalidResultException, MappingExceptionV> valueMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(RecordMapper, RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyMapper
- The key mapper.valueMapper
- The value mapper.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping recordsInvalidResultException
- if the key list is non-unique in the result set.DataAccessException
- See Also:
-
fetchMap
@NotNull @Blocking <S extends Record> @NotNull Map<S,R> fetchMap(Table<S> table) throws DataAccessException Execute the query and return aMap
with table as a map key and the corresponding record as value.An
InvalidResultException
is thrown, if the keys turn out to be non-unique in the result set. UsefetchGroups(Table)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
table
- The key table. Client code must assure that keys are unique in the result set. May not benull
.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <S extends Record,T extends Record> @NotNull Map<S,T> fetchMap(Table<S> keyTable, Table<T> valueTable) throws DataAccessException Execute the query and return aMap
with table as a map key and the corresponding record as value.An
InvalidResultException
is thrown, if the keys turn out to be non-unique in the result set. UsefetchGroups(Table, Table)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyTable
- The key table. Client code must assure that keys are unique in the result set. May not benull
.valueTable
- The value table. May not benull
.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E,S extends Record> @NotNull Map<S,E> fetchMap(Table<S> table, Class<? extends E> type) throws DataAccessException, MappingException Execute the query and return aMap
with results grouped by the given table and mapped into the given entity type.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Table, Class)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
table
- The key table. Client code must assure that keys are unique in the result set. May not benull
.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <E,S extends Record> @NotNull Map<S,E> fetchMap(Table<S> table, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionExecute the query and return aMap
with results grouped by the given table and mapped by the given mapper.An
InvalidResultException
is thrown, if the keys are non-unique in the result set. UsefetchGroups(Table, RecordMapper)
instead, if your keys are non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
table
- The key table. Client code must assure that keys are unique in the result set. May not benull
.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the keys are non-unique in the result set.MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchMap
@NotNull @Blocking <K,E> @NotNull Map<K,E> fetchMap(Field<K> key, Class<? extends E> type) throws DataAccessException Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Field)
for lookup.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(Field, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
key
- The key. Client code must assure that key is unique in the result set.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<?,E> fetchMap(int keyFieldIndex, Class<? extends E> type) throws DataAccessException Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(int, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key. Client code must assure that key is unique in the result set.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<?,E> fetchMap(String keyFieldName, Class<? extends E> type) throws DataAccessException Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(String)
for lookup.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(String, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key. Client code must assure that key is unique in the result set.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<?,E> fetchMap(Name keyFieldName, Class<? extends E> type) throws DataAccessException Execute the query and return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Name)
for lookup.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(Name, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key. Client code must assure that key is unique in the result set.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <K,E> @NotNull Map<K,E> fetchMap(Field<K> key, RecordMapper<? super R, E> mapper) throws DataAccessExceptionExecute the query and return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Field)
for lookup.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(Field, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
key
- The key. Client code must assure that key is unique in the result set.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<?,E> fetchMap(int keyFieldIndex, RecordMapper<? super R, E> mapper) throws DataAccessExceptionExecute the query and return aMap
with results grouped by the given key and mapped by the given mapper.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(int, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key. Client code must assure that key is unique in the result set.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<?,E> fetchMap(String keyFieldName, RecordMapper<? super R, E> mapper) throws DataAccessExceptionExecute the query and return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(String)
for lookup.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(String, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key. Client code must assure that key is unique in the result set.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchMap
@NotNull @Blocking <E> @NotNull Map<?,E> fetchMap(Name keyFieldName, RecordMapper<? super R, E> mapper) throws DataAccessExceptionExecute the query and return aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Name)
for lookup.An exception is thrown, if the key turn out to be non-unique in the result set. Use
fetchGroups(Name, Class)
instead, if your key is non-unique.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key. Client code must assure that key is unique in the result set.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result set.- See Also:
-
fetchGroups
@NotNull @Blocking <K> @NotNull Map<K,Result<R>> fetchGroups(Field<K> key) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value, usingFields.field(Field)
for lookup.Unlike
fetchMap(Field)
, this method allows for non-unique keys in the result set.The resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Type Parameters:
K
- The key's generic field type- Parameters:
key
- The key field.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<?,Result<R>> fetchGroups(int keyFieldIndex) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value.Unlike
fetchMap(int)
, this method allows for non-unique keys in the result set.The resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key field index.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<?,Result<R>> fetchGroups(String keyFieldName) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value, usingFields.field(String)
for lookup.Unlike
fetchMap(String)
, this method allows for non-unique keys in the result set.The resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<?,Result<R>> fetchGroups(Name keyFieldName) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and a list of corresponding records as value, usingFields.field(Name)
for lookup.Unlike
fetchMap(Name)
, this method allows for non-unique keys in the result set.The resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking <K,V> @NotNull Map<K,List<V>> fetchGroups(Field<K> key, Field<V> value) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Field)
for lookup.Unlike
fetchMap(Field, Field)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
If the argument
Field
s are the same as the ones you've provided toDSLContext.select(SelectField, SelectField)
, then you could also just callcollect(Collector)
withRecords.intoGroups()
.- Type Parameters:
K
- The key's generic field typeV
- The value's generic field type- Parameters:
key
- The key field.value
- The value field- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<?,List<?>> fetchGroups(int keyFieldIndex, int valueFieldIndex) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value.Unlike
fetchMap(int, int)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key field index.valueFieldIndex
- The value field index.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<?,List<?>> fetchGroups(String keyFieldName, String valueFieldName) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(String)
for lookup.Unlike
fetchMap(String, String)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.valueFieldName
- The value field name.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<?,List<?>> fetchGroups(Name keyFieldName, Name valueFieldName) throws DataAccessException Execute the query and return aMap
with one of the result's columns as key and another one of the result's columns as value, usingFields.field(Name)
for lookup.Unlike
fetchMap(Name, Name)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.valueFieldName
- The value field name.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<R>> fetchGroups(Field<?>[] keys) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Field)
for lookup.Unlike
fetchMap(Field[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<R>> fetchGroups(int[] keyFieldIndexes) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys.Unlike
fetchMap(int[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<R>> fetchGroups(String[] keyFieldNames) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(String)
for lookup.Unlike
fetchMap(String[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<R>> fetchGroups(Name[] keyFieldNames) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Name)
for lookup.Unlike
fetchMap(Name[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<Record>> fetchGroups(Field<?>[] keys, Field<?>[] values) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Field)
for lookup.Unlike
fetchMap(Field[], Field[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.values
- The values.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<Record>> fetchGroups(int[] keyFieldIndexes, int[] valueFieldIndexes) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys.Unlike
fetchMap(int[], int[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.valueFieldIndexes
- The values.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<Record>> fetchGroups(String[] keyFieldNames, String[] valueFieldNames) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(String)
for lookup.Unlike
fetchMap(String[], String[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.valueFieldNames
- The values.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking @NotNull Map<Record,Result<Record>> fetchGroups(Name[] keyFieldNames, Name[] valueFieldNames) throws DataAccessException Execute the query and return aMap
with the result grouped by the given keys, usingFields.field(Name)
for lookup.Unlike
fetchMap(Name[], Name[])
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys used for result grouping. If this isnull
or an empty array, the resulting map will contain at most one entry.valueFieldNames
- The values returned per group.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(Field<?>[] keys, Class<? extends E> type) throws MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Field)
for lookup.Unlike
fetchMap(Field[], Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(int[] keyFieldIndexes, Class<? extends E> type) throws MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type.Unlike
fetchMap(int[], Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(String[] keyFieldNames, Class<? extends E> type) throws MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(String)
for lookup.Unlike
fetchMap(String[], Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(Name[] keyFieldNames, Class<? extends E> type) throws MappingException Execute the query and return aMap
with results grouped by the given keys and mapped into the given entity type, usingFields.field(Name)
for lookup.Unlike
fetchMap(Name[], Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(Field<?>[] keys, RecordMapper<? super R, E> mapper) throws MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Field)
for lookup.Unlike
fetchMap(Field[], RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keys
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(int[] keyFieldIndexes, RecordMapper<? super R, E> mapper) throws MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper.Unlike
fetchMap(int[], RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndexes
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(String[] keyFieldNames, RecordMapper<? super R, E> mapper) throws MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(String)
for lookup.Unlike
fetchMap(String[], RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<Record,List<E>> fetchGroups(Name[] keyFieldNames, RecordMapper<? super R, E> mapper) throws MappingExceptionExecute the query and return aMap
with results grouped by the given keys and mapped by the given mapper, usingFields.field(Name)
for lookup.Unlike
fetchMap(Name[], RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldNames
- The keys. If this isnull
or an empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K> @NotNull Map<K,Result<R>> fetchGroups(Class<? extends K> keyType) throws MappingException Execute the query and return aMap
with results grouped by the given key entity.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.Unlike
fetchMap(Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyType
- The key type. If this isnull
, the resulting map will contain at most one entry.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K,V> @NotNull Map<K,List<V>> fetchGroups(Class<? extends K> keyType, Class<? extends V> valueType) throws MappingException Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.Unlike
fetchMap(Class, Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyType
- The key type. If this isnull
, the resulting map will contain at most one entry.valueType
- The value type.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K,V> @NotNull Map<K,List<V>> fetchGroups(Class<? extends K> keyType, RecordMapper<? super R, V> valueMapper) throws MappingExceptionExecute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.Unlike
fetchMap(Class, RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyType
- The key type. If this isnull
, the resulting map will contain at most one entry.valueMapper
- The value mapper.- Returns:
- A Map containing grouped results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K> @NotNull Map<K,Result<R>> fetchGroups(RecordMapper<? super R, K> keyMapper) throws MappingExceptionExecute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.Unlike
fetchMap(RecordMapper, RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyMapper
- The key mapper.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K,V> @NotNull Map<K,List<V>> fetchGroups(RecordMapper<? super R, K> keyMapper, Class<V> valueType) throws MappingExceptionExecute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.Unlike
fetchMap(RecordMapper, Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyMapper
- The key mapper.valueType
- The value type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K,V> @NotNull Map<K,List<V>> fetchGroups(RecordMapper<? super R, K> keyMapper, RecordMapper<? super R, throws MappingExceptionV> valueMapper) Execute the query and return aMap
with results grouped by the given key entity and mapped into the given entity type.The grouping semantics is governed by the key type's
Object.equals(Object)
andObject.hashCode()
implementation, not necessarily the values as fetched from the database.Unlike
fetchMap(RecordMapper, RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyMapper
- The key mapper.valueMapper
- The value mapper.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
MappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <S extends Record> @NotNull Map<S,Result<R>> fetchGroups(Table<S> table) throws DataAccessException Execute the query and return aMap
with the result grouped by the given table.Unlike
fetchMap(Table)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
table
- The key table. May not benull
.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking <S extends Record,T extends Record> @NotNull Map<S,Result<T>> fetchGroups(Table<S> keyTable, Table<T> valueTable) throws DataAccessException Execute the query and return aMap
with the result grouped by the given table.Unlike
fetchMap(Table, Table)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyTable
- The key table. May not benull
.valueTable
- The value table. May not benull
.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchGroups
@NotNull @Blocking <E,S extends Record> @NotNull Map<S,List<E>> fetchGroups(Table<S> table, Class<? extends E> type) throws DataAccessException, MappingException Execute the query and return aMap
with results grouped by the given table and mapped into the given entity type.Unlike
fetchMap(Table, Class)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
table
- The key table. May not benull
.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E,S extends Record> @NotNull Map<S,List<E>> fetchGroups(Table<S> table, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionExecute the query and return aMap
with results grouped by the given table and mapped by the given mapper.Unlike
fetchMap(Table, RecordMapper)
, this method allows for non-unique keys in the result set.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
table
- The key table. May not benull
.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K,E> @NotNull Map<K,List<E>> fetchGroups(Field<K> key, Class<? extends E> type) throws DataAccessException, MappingException Return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Field)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Type Parameters:
K
- The key's generic field typeE
- The generic entity type.- Parameters:
key
- The key field.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<?,List<E>> fetchGroups(int keyFieldIndex, Class<? extends E> type) throws DataAccessException, MappingException Return aMap
with results grouped by the given key and mapped into the given entity type.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key field index.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<?,List<E>> fetchGroups(String keyFieldName, Class<? extends E> type) throws DataAccessException, MappingException Return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(String)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<?,List<E>> fetchGroups(Name keyFieldName, Class<? extends E> type) throws DataAccessException, MappingException Return aMap
with results grouped by the given key and mapped into the given entity type, usingFields.field(Name)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.type
- The entity type.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <K,E> @NotNull Map<K,List<E>> fetchGroups(Field<K> key, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionReturn aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Field)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Type Parameters:
K
- The key's generic field typeE
- The generic entity type.- Parameters:
key
- The key field.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<?,List<E>> fetchGroups(int keyFieldIndex, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionReturn aMap
with results grouped by the given key and mapped by the given mapper.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldIndex
- The key field index.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<?,List<E>> fetchGroups(String keyFieldName, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionReturn aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(String)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchGroups
@NotNull @Blocking <E> @NotNull Map<?,List<E>> fetchGroups(Name keyFieldName, RecordMapper<? super R, E> mapper) throws DataAccessException, MappingExceptionReturn aMap
with results grouped by the given key and mapped by the given mapper, usingFields.field(Name)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.The resulting map is iteration order preserving.
- Parameters:
keyFieldName
- The key field name.mapper
- The mapper callback.- Returns:
- A Map containing the results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchArrays
@Nullable @Blocking @Nullable Object @NotNull [] @NotNull [] fetchArrays() throws DataAccessExceptionExecute the query and return the generated result as an Object matrix.You can access data like this
query.fetchArray()[recordIndex][fieldIndex]
- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
Execute the query and return the generated result as an array of records.- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Nullable @Blocking @Nullable Object @NotNull [] fetchArray(int fieldIndex) throws DataAccessException Execute the query and return all values for a field index from the generated result.You can access data like this
query.fetchArray(fieldIndex)[recordIndex]
- Returns:
- The resulting values. This may be an array type more concrete
than
Object[]
, depending on whether jOOQ has any knowledge aboutfieldIndex
's actual type. This will never benull
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <U> U @NotNull [] fetchArray(int fieldIndex, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field index from the generated result.You can access data like this
query.fetchArray(fieldIndex)[recordIndex]
The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <U> U @NotNull [] fetchArray(int fieldIndex, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field index from the generated result.You can access data like this
query.fetchArray(fieldIndex)[recordIndex]
- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Nullable @Blocking @Nullable Object @NotNull [] fetchArray(String fieldName) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.You can access data like this
query.fetchArray(fieldName)[recordIndex]
- Returns:
- The resulting values. This may be an array type more concrete
than
Object[]
, depending on whether jOOQ has any knowledge aboutfieldName
's actual type. This will never benull
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <U> U @NotNull [] fetchArray(String fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.You can access data like this
query.fetchArray(fieldName)[recordIndex]
The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <U> U @NotNull [] fetchArray(String fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.You can access data like this
query.fetchArray(fieldName)[recordIndex]
- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Nullable @Blocking @Nullable Object @NotNull [] fetchArray(Name fieldName) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.You can access data like this
query.fetchArray(fieldName)[recordIndex]
- Returns:
- The resulting values. This may be an array type more concrete
than
Object[]
, depending on whether jOOQ has any knowledge aboutfieldName
's actual type. This will never benull
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <U> U @NotNull [] fetchArray(Name fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.You can access data like this
query.fetchArray(fieldName)[recordIndex]
The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <U> U @NotNull [] fetchArray(Name fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.You can access data like this
query.fetchArray(fieldName)[recordIndex]
- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.You can access data like this
query.fetchArray(field)[recordIndex]
- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <U> U @NotNull [] fetchArray(Field<?> field, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.You can access data like this
query.fetchArray(field)[recordIndex]
The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchArray
@Blocking <T,U> U @NotNull [] fetchArray(Field<T> field, Converter<? super T, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.You can access data like this
query.fetchArray(field)[recordIndex]
- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <E> @NotNull Set<E> fetchSet(RecordMapper<? super R, E> mapper) throws DataAccessExceptionFetch results into a custom mapper callback.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Parameters:
mapper
- The mapper callback- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchSet
Execute the query and return all values for a field index from the generated result.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <U> @NotNull Set<U> fetchSet(int fieldIndex, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field index from the generated result.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <U> @NotNull Set<U> fetchSet(int fieldIndex, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field index from the generated result.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <U> @NotNull Set<U> fetchSet(String fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <U> @NotNull Set<U> fetchSet(String fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field name from the generated result, usingFields.field(String)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <U> @NotNull Set<U> fetchSet(Name fieldName, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <U> @NotNull Set<U> fetchSet(Name fieldName, Converter<?, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field name from the generated result, usingFields.field(Name)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.If the argument
Field
s are the same as the ones you've provided toDSLContext.select(SelectField)
, then you could also just callcollect(Collector)
withRecords.intoSet()
.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <U> @NotNull Set<U> fetchSet(Field<?> field, Class<? extends U> type) throws DataAccessException Execute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.The
Converter
that is provided byConfiguration.converterProvider()
will be used to convert the value toU
Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchSet
@NotNull @Blocking <T,U> @NotNull Set<U> fetchSet(Field<T> field, Converter<? super T, ? extends U> converter) throws DataAccessExceptionExecute the query and return all values for a field from the generated result, usingFields.field(Field)
for lookup.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Returns:
- The resulting values. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchInto
@NotNull @Blocking <E> @NotNull List<E> fetchInto(Class<? extends E> type) throws DataAccessException, MappingException Map resulting records onto a custom type.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Type Parameters:
E
- The generic entity type.- Parameters:
type
- The entity type.- Returns:
- The results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion exception that might have occurred while mapping records- See Also:
-
fetchInto
@NotNull @Blocking <Z extends Record> @NotNull Result<Z> fetchInto(Table<Z> table) throws DataAccessException Map resulting records onto a custom record.This is the same as calling
fetch().into(table)
. SeeRecord.into(Table)
for more detailsThe result and its contained records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Type Parameters:
Z
- The generic table record type.- Parameters:
table
- The table type.- Returns:
- The results. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query- See Also:
-
fetchInto
@Deprecated(forRemoval=true, since="3.15") @NotNull @Blocking <H extends RecordHandler<? super R>> H fetchInto(H handler) throws DataAccessException Deprecated, for removal: This API element is subject to removal in a future version.- 3.15.0 - [#11902] - UseIterable.forEach(Consumer)
based methods, instead.Fetch results into a custom handler callback.The resulting records are attached to the original
Configuration
by default. UseSettings.isAttachRecords()
to override this behaviour.- Parameters:
handler
- The handler callback- Returns:
- Convenience result, returning the parameter handler itself
- Throws:
DataAccessException
- if something went wrong executing the query
-
fetch
@NotNull @Blocking <E> @NotNull List<E> fetch(RecordMapper<? super R, E> mapper) throws DataAccessExceptionFetch results into a custom mapper callback.Whether this fetches an intermediate
Result
(accessible byExecuteListener
implementations), or streams records directly to the collector producing the result is governed bySettings.getFetchIntermediateResult()
.- Parameters:
mapper
- The mapper callback- Returns:
- The result. This will never be
null
. - Throws:
DataAccessException
- if something went wrong executing the query
-
fetchAsync
Fetch results in a newCompletionStage
.The result is asynchronously completed by a task running in an
Executor
provided by the underlyingConfiguration.executorProvider()
.- Returns:
- The completion stage. The completed result will never be
null
.
-
fetchAsync
Fetch results in a newCompletionStage
that is asynchronously completed by a task running in the given executor.- Returns:
- The completion stage. The completed result will never be
null
.
-
getResult
Return the result generated by a previous call to execute().- Returns:
- The result or
null
if no call to execute() was done previously.
-
getRecordType
The record type produced by this query. -
bind
@NotNull @NotNull ResultQuery<R> bind(String param, Object value) throws IllegalArgumentException, DataTypeException Description copied from interface:Query
Bind a new value to a named parameter.[#1886] If the bind value with name
param
is inlined (Param.isInline()
) or if this query was created withStatementType.STATIC_STATEMENT
and there is an underlyingPreparedStatement
kept open because ofQuery.keepStatement(boolean)
, the underlyingPreparedStatement
will be closed automatically in order for new bind values to have an effect.- Specified by:
bind
in interfaceQuery
- Parameters:
param
- The named parameter name. If this is a number, then this is the same as callingQuery.bind(int, Object)
value
- The new bind value.- Throws:
IllegalArgumentException
- if there is no parameter by the given parameter name or index.DataTypeException
- ifvalue
cannot be converted into the parameter's data type
-
bind
@NotNull @NotNull ResultQuery<R> bind(int index, Object value) throws IllegalArgumentException, DataTypeException Description copied from interface:Query
Bind a new value to an indexed parameter.Bind index order
The 1-based parameter index describes a parameter in rendering order, not in input order. For example, if a query contains aDSL.log(Field, Field)
call, where the first argument is thevalue
and the second argument is thebase
, this may produce different dialect specific renderings:- Db2:
ln(value) / ln(base)
- Oracle:
log(base, value)
- SQL Server:
log(value, base)
Some bind values may even be repeated by a dialect specific emulation, leading to duplication and index-shifting.
As such, it is usually better to supply bind values directly with the input of an expression, e.g.:
- Directly with the
DSL
method, such asDSL.log(Field, Field)
, for example. - With the plain SQL template constructor, e.g.
DSL.field(String, Object...)
- With the parser method, e.g.
Parser.parseField(String, Object...)
Inlined values
[#1886] If the bind value at
index
is inlined (Param.isInline()
) or if this query was created withStatementType.STATIC_STATEMENT
and there is an underlyingPreparedStatement
kept open because ofQuery.keepStatement(boolean)
, the underlyingPreparedStatement
will be closed automatically in order for new bind values to have an effect.- Specified by:
bind
in interfaceQuery
- Parameters:
index
- The parameter index in rendering order, starting with 1value
- The new bind value.- Throws:
IllegalArgumentException
- if there is no parameter by the given parameter index.DataTypeException
- ifvalue
cannot be converted into the parameter's data type
- Db2:
-
poolable
Description copied from interface:Query
Specify whether any JDBCStatement
created by this query should beStatement.setPoolable(boolean)
.If this method is not called on jOOQ types, then jOOQ will not specify the flag on JDBC either, resulting in JDBC's default behaviour.
-
queryTimeout
Description copied from interface:Query
Specify the query timeout in number of seconds for the underlying JDBCStatement
.- Specified by:
queryTimeout
in interfaceQuery
- See Also:
-
keepStatement
Description copied from interface:Query
Keep the query's underlying statement open after execution.This indicates to jOOQ that the query's underlying
Statement
orPreparedStatement
should be kept open after execution. If it is kept open, client code is responsible for properly closing it usingCloseableQuery.close()
, e.g. via atry-with-resources
statement.- Specified by:
keepStatement
in interfaceQuery
- Parameters:
keepStatement
- Whether to keep the underlying statement open
-
maxRows
Specify the maximum number of rows returned by the underlyingStatement
.This is not the same as setting a
LIMIT … OFFSET
clause onto the statement, where the result set is restricted within the database.- See Also:
-
fetchSize
Specify the fetch size of the underlyingStatement
.Regardless of this setting,
fetchLazy()
is the only way in jOOQ not to fetch all data in memory. However, you may influence how your JDBC driver interacts with your database through specifying a fetch size.Dialect-specific remarks:
- MySQL uses
Integer.MIN_VALUE
as an indicator to fetch resulting rows row-by-row in conjunction withResultSet.TYPE_FORWARD_ONLY
(set inresultSetType(int)
) andResultSet.CONCUR_READ_ONLY
(set inresultSetConcurrency(int)
). See this page here for details. - PostgreSQL does not like fetch sizes being combined with
. For more information, see this page hereConnection.getAutoCommit()
== true
- See Also:
- MySQL uses
-
resultSetConcurrency
Specify theResultSet
concurrency ofResultSet
objects created by jOOQ.This will affect the way you may perceive
ResultSet
objects obtained from any of these methods:- See Also:
-
resultSetType
Specify theResultSet
type ofResultSet
objects created by jOOQ.This will affect the way you may perceive
ResultSet
objects obtained from any of these methods:- See Also:
-
resultSetHoldability
Specify theResultSet
holdability ofResultSet
objects created by jOOQ.This will affect the way you may perceive
ResultSet
objects obtained from any of these methods:- See Also:
-
intern
@NotNull @Deprecated(forRemoval=true, since="3.10") @NotNull ResultQuery<R> intern(Field<?>... fields) Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0Specify a set of fields whose values should be interned.Unlike
Result
'sintern()
methods, this already interns values right after fetching them from a JDBC result set. SeeResult.intern(int...)
for more details.- Parameters:
fields
- The fields whose values should be interned- Returns:
- The same result query
- See Also:
-
intern
@NotNull @Deprecated(forRemoval=true, since="3.10") @NotNull ResultQuery<R> intern(int... fieldIndexes) Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0Specify a set of field indexes whose values should be interned.Unlike
Result
'sintern()
methods, this already interns values right after fetching them from a JDBC result set. SeeResult.intern(int...)
for more details.- Parameters:
fieldIndexes
- The field indexes whose values should be interned- Returns:
- The same result query
- See Also:
-
intern
@NotNull @Deprecated(forRemoval=true, since="3.10") @NotNull ResultQuery<R> intern(String... fieldNames) Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0Specify a set of field names whose values should be interned.Unlike
Result
'sintern()
methods, this already interns values right after fetching them from a JDBC result set. SeeResult.intern(String...)
for more details.- Parameters:
fieldNames
- The field names whose values should be interned- Returns:
- The same result query
- See Also:
-
intern
@NotNull @Deprecated(forRemoval=true, since="3.10") @NotNull ResultQuery<R> intern(Name... fieldNames) Deprecated, for removal: This API element is subject to removal in a future version.- 3.10 - [#6254] - This functionality is no longer supported and will be removed in 4.0Specify a set of field names whose values should be interned.Unlike
Result
'sintern()
methods, this already interns values right after fetching them from a JDBC result set. SeeResult.intern(Name...)
for more details.- Parameters:
fieldNames
- The field names whose values should be interned- Returns:
- The same result query
- See Also:
-
coerce
Coerce the result record type of this query to that of a table. -
coerce
Coerce the result record type of this query to that of a set of fields. -
coerce
Coerce the result record type of this query to that of a set of fields. -
coerce
Coerce the result record type of this query to that of a set of fields. -
coerce
Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record3<T1,T3> T2, coerceT3>> (Field<T1> field1, Field<T2> field2, Field<T3> field3) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record4<T1,T3, T4> T2, coerceT3, T4>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record5<T1,T3, T4, T5> T2, coerceT3, T4, T5>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record6<T1,T3, T4, T5, T6> T2, coerceT3, T4, T5, T6>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record7<T1,T3, T4, T5, T6, T7> T2, coerceT3, T4, T5, T6, T7>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record8<T1,T3, T4, T5, T6, T7, T8> T2, coerceT3, T4, T5, T6, T7, T8>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record9<T1,T3, T4, T5, T6, T7, T8, T9> T2, coerceT3, T4, T5, T6, T7, T8, T9>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record10<T1,T3, T4, T5, T6, T7, T8, T9, T10> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record11<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record12<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record13<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record14<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record15<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record16<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record17<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record18<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record19<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record20<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record21<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20, Field<T21> field21) Coerce the result record type of this query to that of a set of fields. -
coerce
@NotNull <T1,T2, @NotNull ResultQuery<Record22<T1,T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22> T2, coerceT3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22>> (Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20, Field<T21> field21, Field<T22> field22) Coerce the result record type of this query to that of a set of fields.
-
Iterable.forEach(Consumer)
based methods, instead.