public interface ResultQuery<R extends Record> extends Query, Iterable<R>
Select
query used
for a SELECT
statement.
fetch()
, which completes the whole ConnectionProvider
and
ExecuteListener
lifecycles, eagerly fetching all results into memory.
Underlying JDBC ResultSet
s are always closed. Underlying JDBC
PreparedStatement
s are closed, unless keepStatement(boolean)
is set.
In order to keep open ResultSet
s and fetch records lazily, use
fetchLazy()
instead and then operate on Cursor
.
Modifier and Type | Method and Description |
---|---|
ResultQuery<R> |
bind(int index,
Object value)
Bind a new value to an indexed parameter.
|
ResultQuery<R> |
bind(String param,
Object value)
Bind a new value to a named parameter.
|
Result<R> |
fetch()
Execute the query and return the generated result.
|
<T> List<T> |
fetch(Field<?> field,
Class<? extends T> type)
Execute the query and return all values for a field from the generated
result.
|
<T> List<T> |
fetch(Field<T> field)
Execute the query and return all values for a field from the generated
result.
|
<T,U> List<U> |
fetch(Field<T> field,
Converter<? super T,U> converter)
Execute the query and return all values for a field from the generated
result.
|
List<?> |
fetch(int fieldIndex)
Execute the query and return all values for a field index from the
generated result.
|
<T> List<T> |
fetch(int fieldIndex,
Class<? extends T> type)
Execute the query and return all values for a field index from the
generated result.
|
<U> List<U> |
fetch(int fieldIndex,
Converter<?,U> converter)
Execute the query and return all values for a field index from the
generated result.
|
List<?> |
fetch(Name fieldName)
Execute the query and return all values for a field name from the
generated result.
|
<T> List<T> |
fetch(Name fieldName,
Class<? extends T> type)
Execute the query and return all values for a field name from the
generated result.
|
<U> List<U> |
fetch(Name fieldName,
Converter<?,U> converter)
Execute the query and return all values for a field name from the
generated result.
|
<E> List<E> |
fetch(RecordMapper<? super R,E> mapper)
Fetch results into a custom mapper callback.
|
List<?> |
fetch(String fieldName)
Execute the query and return all values for a field name from the
generated result.
|
<T> List<T> |
fetch(String fieldName,
Class<? extends T> type)
Execute the query and return all values for a field name from the
generated result.
|
<U> List<U> |
fetch(String fieldName,
Converter<?,U> converter)
Execute the query and return all values for a field name from the
generated result.
|
R |
fetchAny()
Execute the query and return at most one resulting record.
|
<T> T |
fetchAny(Field<?> field,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field from the generated result.
|
<T> T |
fetchAny(Field<T> field)
Execute the query and return at most one resulting value for a
field from the generated result.
|
<T,U> U |
fetchAny(Field<T> field,
Converter<? super T,U> converter)
Execute the query and return at most one resulting value for a
field from the generated result.
|
Object |
fetchAny(int fieldIndex)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
<T> T |
fetchAny(int fieldIndex,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
<U> U |
fetchAny(int fieldIndex,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
Object |
fetchAny(Name fieldName)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<T> T |
fetchAny(Name fieldName,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<U> U |
fetchAny(Name fieldName,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<E> E |
fetchAny(RecordMapper<? super R,E> mapper)
Execute the query and return at most one resulting record.
|
Object |
fetchAny(String fieldName)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<T> T |
fetchAny(String fieldName,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<U> U |
fetchAny(String fieldName,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
Object[] |
fetchAnyArray()
Execute the query and return at most one resulting record as an array
You can access data like this
query.fetchAnyArray()[fieldIndex] |
<E> E |
fetchAnyInto(Class<? extends E> type)
Map resulting records onto a custom type.
|
<Z extends Record> |
fetchAnyInto(Table<Z> table)
Map resulting records onto a custom record.
|
Map<String,Object> |
fetchAnyMap()
Execute the query and return at most one resulting record as a name/value
map.
|
R[] |
fetchArray()
Execute the query and return the generated result as an array of records.
|
<T> T[] |
fetchArray(Field<?> field,
Class<? extends T> type)
Execute the query and return all values for a field from the generated
result.
|
<T> T[] |
fetchArray(Field<T> field)
Execute the query and return all values for a field from the generated
result.
|
<T,U> U[] |
fetchArray(Field<T> field,
Converter<? super T,U> converter)
Execute the query and return all values for a field from the generated
result.
|
Object[] |
fetchArray(int fieldIndex)
Execute the query and return all values for a field index from the
generated result.
|
<T> T[] |
fetchArray(int fieldIndex,
Class<? extends T> type)
Execute the query and return all values for a field index from the
generated result.
|
<U> U[] |
fetchArray(int fieldIndex,
Converter<?,U> converter)
Execute the query and return all values for a field index from the
generated result.
|
Object[] |
fetchArray(Name fieldName)
Execute the query and return all values for a field name from the
generated result.
|
<T> T[] |
fetchArray(Name fieldName,
Class<? extends T> type)
Execute the query and return all values for a field name from the
generated result.
|
<U> U[] |
fetchArray(Name fieldName,
Converter<?,U> converter)
Execute the query and return all values for a field name from the
generated result.
|
Object[] |
fetchArray(String fieldName)
Execute the query and return all values for a field name from the
generated result.
|
<T> T[] |
fetchArray(String fieldName,
Class<? extends T> type)
Execute the query and return all values for a field name from the
generated result.
|
<U> U[] |
fetchArray(String fieldName,
Converter<?,U> converter)
Execute the query and return all values for a field name from the
generated result.
|
Object[][] |
fetchArrays()
Execute the query and return the generated result as an Object matrix.
|
<K> Map<K,Result<R>> |
fetchGroups(Class<? extends K> keyType)
Execute the query and return a
Map with results grouped by the
given key entity. |
<K,V> Map<K,List<V>> |
fetchGroups(Class<? extends K> keyType,
Class<? extends V> valueType)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
<K,V> Map<K,List<V>> |
fetchGroups(Class<? extends K> keyType,
RecordMapper<? super R,V> valueMapper)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
Map<Record,Result<R>> |
fetchGroups(Field<?>[] keys)
Execute the query and return a
Map with the result grouped by the
given keys. |
<E> Map<Record,List<E>> |
fetchGroups(Field<?>[] keys,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<Record,List<E>> |
fetchGroups(Field<?>[] keys,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<K> Map<K,Result<R>> |
fetchGroups(Field<K> key)
Execute the query and return a
Map with one of the result's
columns as key and a list of corresponding records as value. |
<K,E> Map<K,List<E>> |
fetchGroups(Field<K> key,
Class<? extends E> type)
Return a
Map with results grouped by the given key and mapped
into the given entity type. |
<K,V> Map<K,List<V>> |
fetchGroups(Field<K> key,
Field<V> value)
Execute the query and return a
Map with one of the result's
columns as key and another one of the result's columns as value
Unlike fetchMap(Field, Field) , this method allows for non-unique
keys in the result set. |
<K,E> Map<K,List<E>> |
fetchGroups(Field<K> key,
RecordMapper<? super R,E> mapper)
Return a
Map with results grouped by the given key and mapped by
the given mapper. |
Map<?,Result<R>> |
fetchGroups(int keyFieldIndex)
Execute the query and return a
Map with one of the result's
columns as key and a list of corresponding records as value. |
Map<Record,Result<R>> |
fetchGroups(int[] keyFieldIndexes)
Execute the query and return a
Map with the result grouped by the
given keys. |
<E> Map<Record,List<E>> |
fetchGroups(int[] keyFieldIndexes,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<Record,List<E>> |
fetchGroups(int[] keyFieldIndexes,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<E> Map<?,List<E>> |
fetchGroups(int keyFieldIndex,
Class<? extends E> type)
Return a
Map with results grouped by the given key and mapped
into the given entity type. |
Map<?,List<?>> |
fetchGroups(int keyFieldIndex,
int valueFieldIndex)
Execute the query and return a
Map 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. |
<E> Map<?,List<E>> |
fetchGroups(int keyFieldIndex,
RecordMapper<? super R,E> mapper)
Return a
Map with results grouped by the given key and mapped by
the given mapper. |
Map<?,Result<R>> |
fetchGroups(Name keyFieldName)
Execute the query and return a
Map with one of the result's
columns as key and a list of corresponding records as value. |
Map<Record,Result<R>> |
fetchGroups(Name[] keyFieldNames)
Execute the query and return a
Map with the result grouped by the
given keys. |
<E> Map<Record,List<E>> |
fetchGroups(Name[] keyFieldNames,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<Record,List<E>> |
fetchGroups(Name[] keyFieldNames,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<E> Map<?,List<E>> |
fetchGroups(Name keyFieldName,
Class<? extends E> type)
Return a
Map with results grouped by the given key and mapped
into the given entity type. |
Map<?,List<?>> |
fetchGroups(Name keyFieldName,
Name valueFieldName)
Execute the query and return a
Map with one of the result's
columns as key and another one of the result's columns as value
Unlike fetchMap(Name, Name) , this method allows for
non-unique keys in the result set. |
<E> Map<?,List<E>> |
fetchGroups(Name keyFieldName,
RecordMapper<? super R,E> mapper)
Return a
Map with results grouped by the given key and mapped by
the given mapper. |
<K> Map<K,Result<R>> |
fetchGroups(RecordMapper<? super R,K> keyMapper)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
<K,V> Map<K,List<V>> |
fetchGroups(RecordMapper<? super R,K> keyMapper,
Class<V> valueType)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
<K,V> Map<K,List<V>> |
fetchGroups(RecordMapper<? super R,K> keyMapper,
RecordMapper<? super R,V> valueMapper)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
Map<?,Result<R>> |
fetchGroups(String keyFieldName)
Execute the query and return a
Map with one of the result's
columns as key and a list of corresponding records as value. |
Map<Record,Result<R>> |
fetchGroups(String[] keyFieldNames)
Execute the query and return a
Map with the result grouped by the
given keys. |
<E> Map<Record,List<E>> |
fetchGroups(String[] keyFieldNames,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<Record,List<E>> |
fetchGroups(String[] keyFieldNames,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<E> Map<?,List<E>> |
fetchGroups(String keyFieldName,
Class<? extends E> type)
Return a
Map with results grouped by the given key and mapped
into the given entity type. |
<E> Map<?,List<E>> |
fetchGroups(String keyFieldName,
RecordMapper<? super R,E> mapper)
Return a
Map with results grouped by the given key and mapped by
the given mapper. |
Map<?,List<?>> |
fetchGroups(String keyFieldName,
String valueFieldName)
Execute the query and return a
Map with one of the result's
columns as key and another one of the result's columns as value
Unlike fetchMap(String, String) , this method allows for
non-unique keys in the result set. |
<S extends Record> |
fetchGroups(Table<S> table)
Execute the query and return a
Map with the result grouped by the
given table. |
<E,S extends Record> |
fetchGroups(Table<S> table,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given table and mapped into the given entity type. |
<E,S extends Record> |
fetchGroups(Table<S> table,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given table and mapped by the given mapper. |
<E> List<E> |
fetchInto(Class<? extends E> type)
Map resulting records onto a custom type.
|
<H extends RecordHandler<? super R>> |
fetchInto(H handler)
Fetch results into a custom handler callback.
|
<Z extends Record> |
fetchInto(Table<Z> table)
Map resulting records onto a custom record.
|
FutureResult<R> |
fetchLater()
Deprecated.
- 3.2.0 - [#2581] - This method will be removed in jOOQ 4.0
|
FutureResult<R> |
fetchLater(ExecutorService executor)
Deprecated.
- 3.2.0 - [#2581] - This method will be removed in jOOQ 4.0
|
Cursor<R> |
fetchLazy()
Execute the query and "lazily" return the generated result.
|
Cursor<R> |
fetchLazy(int fetchSize)
Deprecated.
- [#2811] - 3.3.0 - Use
fetchSize(int) and
fetchLazy() instead. |
Results |
fetchMany()
Execute a query, possibly returning several result sets.
|
<K> Map<K,R> |
fetchMap(Class<? extends K> keyType)
Execute the query and return a
Map with results grouped by the
given key entity. |
<K,V> Map<K,V> |
fetchMap(Class<? extends K> keyType,
Class<? extends V> valueType)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
<K,V> Map<K,V> |
fetchMap(Class<? extends K> keyType,
RecordMapper<? super R,V> valueMapper)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
Map<Record,R> |
fetchMap(Field<?>[] keys)
Execute the query and return a
Map with keys as a map key and the
corresponding record as value. |
<E> Map<List<?>,E> |
fetchMap(Field<?>[] keys,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<List<?>,E> |
fetchMap(Field<?>[] keys,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<K> Map<K,R> |
fetchMap(Field<K> key)
Execute the query and return a
Map with one of the result's
columns as key and the corresponding records as value. |
<K,E> Map<K,E> |
fetchMap(Field<K> key,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given key and mapped into the given entity type. |
<K,V> Map<K,V> |
fetchMap(Field<K> key,
Field<V> value)
Execute the query and return a
Map 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. |
<K,E> Map<K,E> |
fetchMap(Field<K> key,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given key and mapped by the given mapper. |
Map<?,R> |
fetchMap(int keyFieldIndex)
Execute the query and return a
Map with one of the result's
columns as key and the corresponding records as value. |
Map<Record,R> |
fetchMap(int[] keyFieldIndexes)
Execute the query and return a
Map with keys as a map key and the
corresponding record as value. |
<E> Map<List<?>,E> |
fetchMap(int[] keyFieldIndexes,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<List<?>,E> |
fetchMap(int[] keyFieldIndexes,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<E> Map<?,E> |
fetchMap(int keyFieldIndex,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given key and mapped into the given entity type. |
Map<?,?> |
fetchMap(int keyFieldIndex,
int valueFieldIndex)
Execute the query and return a
Map 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. |
<E> Map<?,E> |
fetchMap(int keyFieldIndex,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given key and mapped by the given mapper. |
Map<?,R> |
fetchMap(Name keyFieldName)
Execute the query and return a
Map with one of the result's
columns as key and the corresponding records as value. |
Map<Record,R> |
fetchMap(Name[] keyFieldNames)
Execute the query and return a
Map with keys as a map key and the
corresponding record as value. |
<E> Map<List<?>,E> |
fetchMap(Name[] keyFieldNames,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<List<?>,E> |
fetchMap(Name[] keyFieldNames,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<E> Map<?,E> |
fetchMap(Name keyFieldName,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given key and mapped into the given entity type. |
Map<?,?> |
fetchMap(Name keyFieldName,
Name valueFieldName)
Execute the query and return a
Map 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. |
<E> Map<?,E> |
fetchMap(Name keyFieldName,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given key and mapped by the given mapper. |
<K> Map<K,R> |
fetchMap(RecordMapper<? super R,K> keyMapper)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
<K,V> Map<K,V> |
fetchMap(RecordMapper<? super R,K> keyMapper,
Class<V> valueType)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
<K,V> Map<K,V> |
fetchMap(RecordMapper<? super R,K> keyMapper,
RecordMapper<? super R,V> valueMapper)
Execute the query and return a
Map with results grouped by the
given key entity and mapped into the given entity type. |
Map<?,R> |
fetchMap(String keyFieldName)
Execute the query and return a
Map with one of the result's
columns as key and the corresponding records as value. |
Map<Record,R> |
fetchMap(String[] keyFieldNames)
Execute the query and return a
Map with keys as a map key and the
corresponding record as value. |
<E> Map<List<?>,E> |
fetchMap(String[] keyFieldNames,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given keys and mapped into the given entity type. |
<E> Map<List<?>,E> |
fetchMap(String[] keyFieldNames,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given keys and mapped by the given mapper. |
<E> Map<?,E> |
fetchMap(String keyFieldName,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given key and mapped into the given entity type. |
<E> Map<?,E> |
fetchMap(String keyFieldName,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given key and mapped by the given mapper. |
Map<?,?> |
fetchMap(String keyFieldName,
String valueFieldName)
Execute the query and return a
Map 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. |
<S extends Record> |
fetchMap(Table<S> table)
Execute the query and return a
Map with table as a map key and
the corresponding record as value. |
<E,S extends Record> |
fetchMap(Table<S> table,
Class<? extends E> type)
Execute the query and return a
Map with results grouped by the
given table and mapped into the given entity type. |
<E,S extends Record> |
fetchMap(Table<S> table,
RecordMapper<? super R,E> mapper)
Execute the query and return a
Map with results grouped by the
given table and mapped by the given mapper. |
List<Map<String,Object>> |
fetchMaps()
Execute the query and return the generated result as a list of name/value
maps.
|
R |
fetchOne()
Execute the query and return at most one resulting record.
|
<T> T |
fetchOne(Field<?> field,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field from the generated result.
|
<T> T |
fetchOne(Field<T> field)
Execute the query and return at most one resulting value for a
field from the generated result.
|
<T,U> U |
fetchOne(Field<T> field,
Converter<? super T,U> converter)
Execute the query and return at most one resulting value for a
field from the generated result.
|
Object |
fetchOne(int fieldIndex)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
<T> T |
fetchOne(int fieldIndex,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
<U> U |
fetchOne(int fieldIndex,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
Object |
fetchOne(Name fieldName)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<T> T |
fetchOne(Name fieldName,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<U> U |
fetchOne(Name fieldName,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<E> E |
fetchOne(RecordMapper<? super R,E> mapper)
Execute the query and return at most one resulting value into a
custom mapper callback.
|
Object |
fetchOne(String fieldName)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<T> T |
fetchOne(String fieldName,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<U> U |
fetchOne(String fieldName,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
Object[] |
fetchOneArray()
Execute the query and return at most one resulting record as an array
You can access data like this
query.fetchOneArray()[fieldIndex] |
<E> E |
fetchOneInto(Class<? extends E> type)
Map resulting records onto a custom type.
|
<Z extends Record> |
fetchOneInto(Table<Z> table)
Map resulting records onto a custom record.
|
Map<String,Object> |
fetchOneMap()
Execute the query and return at most one resulting record as a name/value
map.
|
Optional<R> |
fetchOptional()
Execute the query and return at most one resulting record.
|
<T> Optional<T> |
fetchOptional(Field<?> field,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field from the generated result.
|
<T> Optional<T> |
fetchOptional(Field<T> field)
Execute the query and return at most one resulting value for a
field from the generated result.
|
<T,U> Optional<U> |
fetchOptional(Field<T> field,
Converter<? super T,U> converter)
Execute the query and return at most one resulting value for a
field from the generated result.
|
Optional<?> |
fetchOptional(int fieldIndex)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
<T> Optional<T> |
fetchOptional(int fieldIndex,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
<U> Optional<U> |
fetchOptional(int fieldIndex,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field index from the generated result.
|
Optional<?> |
fetchOptional(Name fieldName)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<T> Optional<T> |
fetchOptional(Name fieldName,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<U> Optional<U> |
fetchOptional(Name fieldName,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<E> Optional<E> |
fetchOptional(RecordMapper<? super R,E> mapper)
Execute the query and return at most one resulting value into a
custom mapper callback.
|
Optional<?> |
fetchOptional(String fieldName)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<T> Optional<T> |
fetchOptional(String fieldName,
Class<? extends T> type)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
<U> Optional<U> |
fetchOptional(String fieldName,
Converter<?,U> converter)
Execute the query and return at most one resulting value for a
field name from the generated result.
|
Optional<Object[]> |
fetchOptionalArray()
Execute the query and return at most one resulting record as an array.
|
<E> Optional<E> |
fetchOptionalInto(Class<? extends E> type)
Map resulting records onto a custom type.
|
<Z extends Record> |
fetchOptionalInto(Table<Z> table)
Map resulting records onto a custom record.
|
Optional<Map<String,Object>> |
fetchOptionalMap()
Execute the query and return at most one resulting record as a name/value
map.
|
ResultSet |
fetchResultSet()
Execute the query and return the generated result as a JDBC
ResultSet . |
<T> Set<T> |
fetchSet(Field<?> field,
Class<? extends T> type)
Execute the query and return all values for a field from the generated
result.
|
<T> Set<T> |
fetchSet(Field<T> field)
Execute the query and return all values for a field from the generated
result.
|
<T,U> Set<U> |
fetchSet(Field<T> field,
Converter<? super T,U> converter)
Execute the query and return all values for a field from the generated
result.
|
Set<?> |
fetchSet(int fieldIndex)
Execute the query and return all values for a field index from the
generated result.
|
<T> Set<T> |
fetchSet(int fieldIndex,
Class<? extends T> type)
Execute the query and return all values for a field index from the
generated result.
|
<U> Set<U> |
fetchSet(int fieldIndex,
Converter<?,U> converter)
Execute the query and return all values for a field index from the
generated result.
|
Set<?> |
fetchSet(Name fieldName)
Execute the query and return all values for a field name from the
generated result.
|
<T> Set<T> |
fetchSet(Name fieldName,
Class<? extends T> type)
Execute the query and return all values for a field name from the
generated result.
|
<U> Set<U> |
fetchSet(Name fieldName,
Converter<?,U> converter)
Execute the query and return all values for a field name from the
generated result.
|
Set<?> |
fetchSet(String fieldName)
Execute the query and return all values for a field name from the
generated result.
|
<T> Set<T> |
fetchSet(String fieldName,
Class<? extends T> type)
Execute the query and return all values for a field name from the
generated result.
|
<U> Set<U> |
fetchSet(String fieldName,
Converter<?,U> converter)
Execute the query and return all values for a field name from the
generated result.
|
ResultQuery<R> |
fetchSize(int rows)
Specify the fetch size of the underlying
Statement . |
Class<? extends R> |
getRecordType()
The record type produced by this query.
|
Result<R> |
getResult()
Return the result generated by a previous call to execute().
|
ResultQuery<R> |
intern(Field<?>... fields)
Specify a set of fields whose values should be interned.
|
ResultQuery<R> |
intern(int... fieldIndexes)
Specify a set of field indexes whose values should be interned.
|
ResultQuery<R> |
intern(Name... fieldNames)
Specify a set of field names whose values should be interned.
|
ResultQuery<R> |
intern(String... fieldNames)
Specify a set of field names whose values should be interned.
|
Iterator<R> |
iterator()
Execute the query and return the generated result.
|
ResultQuery<R> |
keepStatement(boolean keepStatement)
Keep the query's underlying statement open after execution.
|
ResultQuery<R> |
maxRows(int rows)
Specify the maximum number of rows returned by the underlying
Statement . |
ResultQuery<R> |
queryTimeout(int timeout)
Specify the query timeout for the underlying JDBC
Statement . |
ResultQuery<R> |
resultSetConcurrency(int resultSetConcurrency)
Specify the
ResultSet concurrency of ResultSet
objects created by jOOQ. |
ResultQuery<R> |
resultSetHoldability(int resultSetHoldability)
Specify the
ResultSet holdability of ResultSet
objects created by jOOQ. |
ResultQuery<R> |
resultSetType(int resultSetType)
Specify the
ResultSet type of ResultSet
objects created by jOOQ. |
java.util.stream.Stream<R> |
stream()
Stream this query.
|
cancel, close, execute, getBindValues, getParam, getParams, getSQL, getSQL, getSQL, isExecutable
attach, detach
forEach, spliterator
Result<R> getResult()
null
if no call to execute() was done
previously.Result<R> fetch() throws DataAccessException
This is the same as calling Query.execute()
and then
getResult()
The result and its contained records are attached to the original
Configuration
by default. Use Settings.isAttachRecords()
to override this behaviour.
ConnectionProvider
and ExecuteListener
lifecycles,
eagerly fetching all results into memory. Underlying JDBC
ResultSet
s are always closed. Underlying JDBC
PreparedStatement
s are closed, unless
keepStatement(boolean)
is set.
In order to keep open ResultSet
s and fetch records lazily, use
fetchLazy()
instead and then operate on Cursor
.
DataAccessException
- if something went wrong executing the queryResultSet fetchResultSet() throws DataAccessException
ResultSet
.
This is the same as calling fetchLazy()
.
resultSet()
and will return a
ResultSet
wrapping the JDBC driver's ResultSet
.
Closing this ResultSet
may close the producing
Statement
or PreparedStatement
, depending on your setting
for keepStatement(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 with DSLContext.fetch(ResultSet)
.
DataAccessException
- if something went wrong executing the queryIterator<R> iterator() throws DataAccessException
This is essentially the same as fetch()
, except that being
declared in Iterable
, this method can be used in Java 5 foreach
statements.
iterator
in interface Iterable<R extends Record>
DataAccessException
java.util.stream.Stream<R> stream() throws DataAccessException
This is essentially the same as fetchLazy()
but instead of
returning a Cursor
, a Java 8 Stream
is returned. 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 via ExecuteListener
, or via "smart"
third-party DataSource
s.
DataAccessException
- if something went wrong executing the queryCursor<R> fetchLazy() throws DataAccessException
The returned Cursor
holds a reference to the executed
PreparedStatement
and the associated ResultSet
. Data can
be fetched (or iterated over) lazily, fetching records from the
ResultSet
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
fetchLazy(int)
Client code is responsible for closing the cursor after use.
DataAccessException
- if something went wrong executing the queryfetchLazy(int)
@Deprecated Cursor<R> fetchLazy(int fetchSize) throws DataAccessException
fetchSize(int)
and
fetchLazy()
instead.
The returned Cursor
holds a reference to the executed
PreparedStatement
and the associated ResultSet
. Data can
be fetched (or iterated over) lazily, fetching records from the
ResultSet
one by one.
Depending on your JDBC driver's behaviour, this will load only
fetchSize
records from the database into memory at once. For
more details, see also Statement.setFetchSize(int)
Client code is responsible for closing the cursor after use.
DataAccessException
- if something went wrong executing the queryfetchLazy()
,
Statement.setFetchSize(int)
Results fetchMany() throws DataAccessException
Example (Sybase ASE):
String sql = "sp_help 'my_table'";
The result and its contained records are attached to the original
Configuration
by default. Use Settings.isAttachRecords()
to override this behaviour.
DataAccessException
- if something went wrong executing the query<T> List<T> fetch(Field<T> field) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(Field)
DataAccessException
- if something went wrong executing the query<T> List<T> fetch(Field<?> field, Class<? extends T> type) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(Field, Class)
DataAccessException
- if something went wrong executing the queryRecord.getValue(Field, Class)
<T,U> List<U> fetch(Field<T> field, Converter<? super T,U> converter) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(Field, Converter)
DataAccessException
- if something went wrong executing the queryRecord.getValue(Field, Converter)
List<?> fetch(int fieldIndex) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(int)
DataAccessException
- if something went wrong executing the query<T> List<T> fetch(int fieldIndex, Class<? extends T> type) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(int, Class)
DataAccessException
- if something went wrong executing the queryRecord.getValue(int, Class)
<U> List<U> fetch(int fieldIndex, Converter<?,U> converter) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(int, Converter)
DataAccessException
- if something went wrong executing the queryRecord.getValue(int, Converter)
List<?> fetch(String fieldName) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(String)
DataAccessException
- if something went wrong executing the query<T> List<T> fetch(String fieldName, Class<? extends T> type) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(String, Class)
DataAccessException
- if something went wrong executing the queryRecord.getValue(String, Class)
<U> List<U> fetch(String fieldName, Converter<?,U> converter) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(String, Converter)
DataAccessException
- if something went wrong executing the queryRecord.getValue(String, Converter)
List<?> fetch(Name fieldName) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(Name)
DataAccessException
- if something went wrong executing the query<T> List<T> fetch(Name fieldName, Class<? extends T> type) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(Name, Class)
DataAccessException
- if something went wrong executing the queryRecord.getValue(Name, Class)
<U> List<U> fetch(Name fieldName, Converter<?,U> converter) throws DataAccessException
This is the same as calling fetch()
and then
Result.getValues(Name, Converter)
DataAccessException
- if something went wrong executing the queryRecord.getValue(Name, Converter)
<T> T fetchOne(Field<T> field) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(Field)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> T fetchOne(Field<?> field, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(Field, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T,U> U fetchOne(Field<T> field, Converter<? super T,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(Field, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordObject fetchOne(int fieldIndex) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(int)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> T fetchOne(int fieldIndex, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(int, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<U> U fetchOne(int fieldIndex, Converter<?,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(int, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordObject fetchOne(String fieldName) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(String)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> T fetchOne(String fieldName, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(String, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<U> U fetchOne(String fieldName, Converter<?,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(String, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordObject fetchOne(Name fieldName) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(Name)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> T fetchOne(Name fieldName, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(Name, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<U> U fetchOne(Name fieldName, Converter<?,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOne()
and then
Record.getValue(Name, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordR fetchOne() throws DataAccessException, TooManyRowsException
The resulting record is attached to the original Configuration
by
default. Use Settings.isAttachRecords()
to override this
behaviour.
null
if the query returns no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<E> E fetchOne(RecordMapper<? super R,E> mapper) throws DataAccessException, TooManyRowsException
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordMap<String,Object> fetchOneMap() throws DataAccessException, TooManyRowsException
null
if the query returns no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordResult.intoMaps()
,
Record.intoMap()
Object[] fetchOneArray() throws DataAccessException, TooManyRowsException
You can access data like this
query.fetchOneArray()[fieldIndex]
null
if the query returns no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<E> E fetchOneInto(Class<? extends E> type) throws DataAccessException, MappingException, TooManyRowsException
This is the same as calling
. See
E result = null;
Record r = q.fetchOne();
if (r != null)
result = r.into(type);
Record.into(Class)
for more details
E
- The generic entity type.type
- The entity type.null
if the query returns no
records.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 recordRecord.into(Class)
,
Result.into(Class)
,
DefaultRecordMapper
<Z extends Record> Z fetchOneInto(Table<Z> table) throws DataAccessException, TooManyRowsException
This is the same as calling
. See
Z result = null;
Record r = q.fetchOne();
if (r != null)
result = r.into(table);
Record.into(Table)
for more details
The resulting record is attached to the original Configuration
by
default. Use Settings.isAttachRecords()
to override this
behaviour.
Z
- The generic table record type.table
- The table type.null
if the query returns no
records.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordRecord.into(Table)
,
Result.into(Table)
<T> Optional<T> fetchOptional(Field<T> field) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(Field)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> Optional<T> fetchOptional(Field<?> field, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(Field, Class)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T,U> Optional<U> fetchOptional(Field<T> field, Converter<? super T,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(Field, Converter)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordOptional<?> fetchOptional(int fieldIndex) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(int)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> Optional<T> fetchOptional(int fieldIndex, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(int, Class)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<U> Optional<U> fetchOptional(int fieldIndex, Converter<?,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(int, Converter)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordOptional<?> fetchOptional(String fieldName) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(String)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> Optional<T> fetchOptional(String fieldName, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(String, Class)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<U> Optional<U> fetchOptional(String fieldName, Converter<?,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(String, Converter)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordOptional<?> fetchOptional(Name fieldName) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(Name)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<T> Optional<T> fetchOptional(Name fieldName, Class<? extends T> type) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(Name, Class)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<U> Optional<U> fetchOptional(Name fieldName, Converter<?,U> converter) throws DataAccessException, TooManyRowsException
This is the same as calling fetchOptional()
and then
Record.getValue(Name, Converter)
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordOptional<R> fetchOptional() throws DataAccessException, TooManyRowsException
The resulting record is attached to the original Configuration
by
default. Use Settings.isAttachRecords()
to override this
behaviour.
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<E> Optional<E> fetchOptional(RecordMapper<? super R,E> mapper) throws DataAccessException, TooManyRowsException
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordOptional<Map<String,Object>> fetchOptionalMap() throws DataAccessException, TooManyRowsException
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordResult.intoMaps()
,
Record.intoMap()
Optional<Object[]> fetchOptionalArray() throws DataAccessException, TooManyRowsException
DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one record<E> Optional<E> fetchOptionalInto(Class<? extends E> type) throws DataAccessException, MappingException, TooManyRowsException
This is the same as calling
. See
Optional<E> result = q.fetchOptional().map(r -> r.into(type));
Record.into(Class)
for more details
E
- The generic entity type.type
- The entity type.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 recordRecord.into(Class)
,
Result.into(Class)
,
DefaultRecordMapper
<Z extends Record> Optional<Z> fetchOptionalInto(Table<Z> table) throws DataAccessException, TooManyRowsException
This is the same as calling
. See
Optional<Z> result = q.fetchOptional().map(r -> r.into(table));
Record.into(Table)
for more details
The resulting record is attached to the original Configuration
by
default. Use Settings.isAttachRecords()
to override this
behaviour.
Z
- The generic table record type.table
- The table type.DataAccessException
- if something went wrong executing the queryTooManyRowsException
- if the query returned more than one recordRecord.into(Table)
,
Result.into(Table)
<T> T fetchAny(Field<T> field) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(Field)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<T> T fetchAny(Field<?> field, Class<? extends T> type) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(Field, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<T,U> U fetchAny(Field<T> field, Converter<? super T,U> converter) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(Field, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryObject fetchAny(int fieldIndex) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(int)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<T> T fetchAny(int fieldIndex, Class<? extends T> type) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(int, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<U> U fetchAny(int fieldIndex, Converter<?,U> converter) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(int, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryObject fetchAny(String fieldName) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(String)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<T> T fetchAny(String fieldName, Class<? extends T> type) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(String, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<U> U fetchAny(String fieldName, Converter<?,U> converter) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(String, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryObject fetchAny(Name fieldName) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(Name)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<T> T fetchAny(Name fieldName, Class<? extends T> type) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(Name, Class)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the query<U> U fetchAny(Name fieldName, Converter<?,U> converter) throws DataAccessException
This is the same as calling fetchOne()
and then
Record.getValue(Name, Converter)
null
if the query returned no
records.DataAccessException
- if something went wrong executing the queryR fetchAny() throws DataAccessException
The resulting record is attached to the original Configuration
by
default. Use Settings.isAttachRecords()
to override this
behaviour.
null
if the query
returns no records.DataAccessException
- if something went wrong executing the query<E> E fetchAny(RecordMapper<? super R,E> mapper) throws DataAccessException
The resulting record is attached to the original Configuration
by
default. Use Settings.isAttachRecords()
to override this
behaviour.
null
if the query
returns no records.DataAccessException
- if something went wrong executing the queryMap<String,Object> fetchAnyMap() throws DataAccessException
null
if the query returns no
records.DataAccessException
- if something went wrong executing the queryResult.intoMaps()
,
Record.intoMap()
Object[] fetchAnyArray() throws DataAccessException
You can access data like this
query.fetchAnyArray()[fieldIndex]
null
if the query returns no
records.DataAccessException
- if something went wrong executing the query<E> E fetchAnyInto(Class<? extends E> type) throws DataAccessException, MappingException
This is the same as calling
. See
E result = null;
Record r = q.fetchAny();
if (r != null)
result = r.into(type);
Record.into(Class)
for more details
E
- The generic entity type.type
- The entity type.null
if the query returns no
records.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsRecord.into(Class)
,
Result.into(Class)
,
DefaultRecordMapper
<Z extends Record> Z fetchAnyInto(Table<Z> table) throws DataAccessException
This is the same as calling
. See
Z result = null;
Record r = q.fetchOne();
if (r != null)
result = r.into(table);
Record.into(Table)
for more details
The resulting record is attached to the original Configuration
by
default. Use Settings.isAttachRecords()
to override this
behaviour.
Z
- The generic table record type.table
- The table type.null
if the query returns no
records.DataAccessException
- if something went wrong executing the queryRecord.into(Table)
,
Result.into(Table)
List<Map<String,Object>> fetchMaps() throws DataAccessException
DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMaps()
,
Record.intoMap()
<K> Map<K,R> fetchMap(Field<K> key) throws DataAccessException
Map
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(Field)
instead, if your keys are
non-unique
The resulting records are attached to the original Configuration
by default. Use Settings.isAttachRecords()
to override this
behaviour.
K
- The key's generic field typekey
- The key field. Client code must assure that this field is
unique in the result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(Field)
Map<?,R> fetchMap(int keyFieldIndex) throws DataAccessException
Map
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-unique
The resulting records are attached to the original Configuration
by default. Use Settings.isAttachRecords()
to override this
behaviour.
keyFieldIndex
- The key field. Client code must assure that this
field is unique in the result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(int)
Map<?,R> fetchMap(String keyFieldName) throws DataAccessException
Map
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(String)
instead, if your keys are
non-unique
The resulting records are attached to the original Configuration
by default. Use Settings.isAttachRecords()
to override this
behaviour.
keyFieldName
- The key field. Client code must assure that this
field is unique in the result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(String)
Map<?,R> fetchMap(Name keyFieldName) throws DataAccessException
Map
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(Name)
instead, if your keys are
non-unique
The resulting records are attached to the original Configuration
by default. Use Settings.isAttachRecords()
to override this
behaviour.
keyFieldName
- The key field. Client code must assure that this
field is unique in the result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(Name)
<K,V> Map<K,V> fetchMap(Field<K> key, Field<V> value) throws DataAccessException
Map
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(Field, Field)
instead, if your keys
are non-unique
K
- The key's generic field typeV
- The value's generic field typekey
- The key field. Client code must assure that this field is
unique in the result set.value
- The value fieldDataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(Field, Field)
Map<?,?> fetchMap(int keyFieldIndex, int valueFieldIndex) throws DataAccessException
Map
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
keyFieldIndex
- The key field. Client code must assure that this
field is unique in the result set.valueFieldIndex
- The value fieldDataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(int, int)
Map<?,?> fetchMap(String keyFieldName, String valueFieldName) throws DataAccessException
Map
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(String, String)
instead, if your keys
are non-unique
keyFieldName
- The key field. Client code must assure that this
field is unique in the result set.valueFieldName
- The value fieldDataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(String, String)
Map<?,?> fetchMap(Name keyFieldName, Name valueFieldName) throws DataAccessException
Map
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(Name, Name)
instead, if your keys
are non-unique
keyFieldName
- The key field. Client code must assure that this
field is unique in the result set.valueFieldName
- The value fieldDataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key field returned two or more
equal values from the result set.Result.intoMap(Name, Name)
Map<Record,R> fetchMap(Field<?>[] keys) throws DataAccessException
Map
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(Field[])
instead, if your keys are
non-unique.
keys
- The keys. Client code must assure that keys are unique in the
result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the
result set.Result.intoMap(Field[])
Map<Record,R> fetchMap(int[] keyFieldIndexes) throws DataAccessException
Map
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.
keyFieldIndexes
- The keys. Client code must assure that keys are
unique in the result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the
result set.Result.intoMap(int[])
Map<Record,R> fetchMap(String[] keyFieldNames) throws DataAccessException
Map
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(String[])
instead, if your keys are
non-unique.
keyFieldNames
- The keys. Client code must assure that keys are
unique in the result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the
result set.Result.intoMap(String[])
Map<Record,R> fetchMap(Name[] keyFieldNames) throws DataAccessException
Map
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(Name[])
instead, if your keys are
non-unique.
keyFieldNames
- The keys. Client code must assure that keys are
unique in the result set.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the
result set.Result.intoMap(Name[])
<E> Map<List<?>,E> fetchMap(Field<?>[] keys, Class<? extends E> type) throws DataAccessException, MappingException
Map
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. Use fetchGroups(Field[], Class)
instead, if
your keys are non-unique.
keys
- The keys. Client code must assure that keys are unique in the
result set. If this is null
or an empty array,
the resulting map will contain at most one entry.type
- The entity type.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 recordsResult.intoMap(Field[], Class)
,
DefaultRecordMapper
<E> Map<List<?>,E> fetchMap(int[] keyFieldIndexes, Class<? extends E> type) throws DataAccessException, MappingException
Map
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. Use fetchGroups(int[], Class)
instead, if
your keys are non-unique.
keyFieldIndexes
- The keys. Client code must assure that keys are
unique in the result set. If this is null
or an
empty array, the resulting map will contain at most one entry.type
- The entity type.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 recordsResult.intoMap(int[], Class)
,
DefaultRecordMapper
<E> Map<List<?>,E> fetchMap(String[] keyFieldNames, Class<? extends E> type) throws DataAccessException, MappingException
Map
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. Use fetchGroups(String[], Class)
instead, if
your keys are non-unique.
keyFieldNames
- The keys. Client code must assure that keys are
unique in the result set. If this is null
or an
empty array, the resulting map will contain at most one entry.type
- The entity type.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 recordsResult.intoMap(String[], Class)
,
DefaultRecordMapper
<E> Map<List<?>,E> fetchMap(Name[] keyFieldNames, Class<? extends E> type) throws DataAccessException, MappingException
Map
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. Use fetchGroups(Name[], Class)
instead, if
your keys are non-unique.
keyFieldNames
- The keys. Client code must assure that keys are
unique in the result set. If this is null
or an
empty array, the resulting map will contain at most one entry.type
- The entity type.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 recordsResult.intoMap(Name[], Class)
,
DefaultRecordMapper
<E> Map<List<?>,E> fetchMap(Field<?>[] keys, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
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. Use fetchGroups(Field[], RecordMapper)
instead, if your keys are non-unique.
keys
- The keys. Client code must assure that keys are unique in the
result set. If this is null
or an empty array,
the resulting map will contain at most one entry.mapper
- The mapper callback.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 recordsResult.intoMap(Field[], Class)
,
DefaultRecordMapper
<E> Map<List<?>,E> fetchMap(int[] keyFieldIndexes, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
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. Use fetchGroups(int[], RecordMapper)
instead,
if your keys are non-unique.
keyFieldIndexes
- The keys. Client code must assure that keys are
unique in the result set. If this is null
or an
empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.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 recordsResult.intoMap(int[], Class)
,
DefaultRecordMapper
<E> Map<List<?>,E> fetchMap(String[] keyFieldNames, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
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. Use fetchGroups(String[], RecordMapper)
instead, if your keys are non-unique.
keyFieldNames
- The keys. Client code must assure that keys are
unique in the result set. If this is null
or an
empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.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 recordsResult.intoMap(String[], Class)
,
DefaultRecordMapper
<E> Map<List<?>,E> fetchMap(Name[] keyFieldNames, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
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. Use fetchGroups(Name[], RecordMapper)
instead, if your keys are non-unique.
keyFieldNames
- The keys. Client code must assure that keys are
unique in the result set. If this is null
or an
empty array, the resulting map will contain at most one entry.mapper
- The mapper callback.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 recordsResult.intoMap(Name[], Class)
,
DefaultRecordMapper
<K> Map<K,R> fetchMap(Class<? extends K> keyType) throws DataAccessException, MappingException, InvalidResultException
Map
with results grouped by the
given key entity.
The grouping semantics is governed by the key type's
Object.equals(Object)
and Object.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. Use fetchGroups(Class)
instead, if your keys
are non-unique.
keyType
- The key type. If this is null
, the resulting
map will contain at most one entry.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
Result.intoMap(Class)
,
DefaultRecordMapper
<K,V> Map<K,V> fetchMap(Class<? extends K> keyType, Class<? extends V> valueType) throws DataAccessException, MappingException, InvalidResultException
Map
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)
and Object.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. Use fetchGroups(Class, Class)
instead, if
your keys are non-unique.
keyType
- The key type. If this is null
, the resulting
map will contain at most one entry.valueType
- The value type.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
Result.intoMap(Class, Class)
,
DefaultRecordMapper
<K,V> Map<K,V> fetchMap(Class<? extends K> keyType, RecordMapper<? super R,V> valueMapper) throws DataAccessException, InvalidResultException, MappingException
Map
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)
and Object.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. Use fetchGroups(Class, RecordMapper)
instead,
if your keys are non-unique.
keyType
- The key type. If this is null
, the resulting
map will contain at most one entry.valueMapper
- The value mapper.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
Result.intoMap(Class, RecordMapper)
,
DefaultRecordMapper
<K> Map<K,R> fetchMap(RecordMapper<? super R,K> keyMapper) throws DataAccessException, InvalidResultException, MappingException
Map
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)
and Object.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. Use fetchGroups(RecordMapper)
instead, if
your keys are non-unique.
keyMapper
- The key mapper.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
Result.intoMap(RecordMapper)
,
DefaultRecordMapper
<K,V> Map<K,V> fetchMap(RecordMapper<? super R,K> keyMapper, Class<V> valueType) throws DataAccessException, InvalidResultException, MappingException
Map
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)
and Object.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. Use fetchGroups(RecordMapper, Class)
instead,
if your keys are non-unique.
keyMapper
- The key mapper.valueType
- The value type.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
Result.intoMap(RecordMapper, Class)
,
DefaultRecordMapper
<K,V> Map<K,V> fetchMap(RecordMapper<? super R,K> keyMapper, RecordMapper<? super R,V> valueMapper) throws DataAccessException, InvalidResultException, MappingException
Map
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)
and Object.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. Use fetchGroups(RecordMapper, RecordMapper)
instead, if your keys are non-unique.
keyMapper
- The key mapper.valueMapper
- The value mapper.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
Result.intoMap(RecordMapper, RecordMapper)
,
DefaultRecordMapper
<S extends Record> Map<S,R> fetchMap(Table<S> table) throws DataAccessException
Map
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. Use fetchGroups(Table)
instead, if
your keys are non-unique.
table
- The key table. Client code must assure that keys are unique
in the result set. May not be null
.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key list is non-unique in the
result set.Result.intoMap(Table)
<E,S extends Record> Map<S,E> fetchMap(Table<S> table, Class<? extends E> type) throws DataAccessException, MappingException
Map
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. Use fetchGroups(Table, Class)
instead, if
your keys are non-unique.
table
- The key table. Client code must assure that keys are unique
in the result set. May not be null
.type
- The entity type.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 recordsResult.intoMap(Table, Class)
,
DefaultRecordMapper
<E,S extends Record> Map<S,E> fetchMap(Table<S> table, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
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. Use fetchGroups(Table, RecordMapper)
instead,
if your keys are non-unique.
table
- The key table. Client code must assure that keys are unique
in the result set. May not be null
.mapper
- The mapper callback.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 recordsResult.intoMap(Table, Class)
,
DefaultRecordMapper
<K,E> Map<K,E> fetchMap(Field<K> key, Class<? extends E> type) throws DataAccessException
Map
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(Field, Class)
instead, if your key
is non-unique.
key
- The key. Client code must assure that key is unique in the
result set.type
- The entity type.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(Field, Class)
<E> Map<?,E> fetchMap(int keyFieldIndex, Class<? extends E> type) throws DataAccessException
Map
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.
keyFieldIndex
- The key. Client code must assure that key is unique
in the result set.type
- The entity type.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(int, Class)
<E> Map<?,E> fetchMap(String keyFieldName, Class<? extends E> type) throws DataAccessException
Map
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(String, Class)
instead, if your key
is non-unique.
keyFieldName
- The key. Client code must assure that key is unique
in the result set.type
- The entity type.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(String, Class)
<E> Map<?,E> fetchMap(Name keyFieldName, Class<? extends E> type) throws DataAccessException
Map
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(Name, Class)
instead, if your key
is non-unique.
keyFieldName
- The key. Client code must assure that key is unique
in the result set.type
- The entity type.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(Name, Class)
<K,E> Map<K,E> fetchMap(Field<K> key, RecordMapper<? super R,E> mapper) throws DataAccessException
Map
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(Field, Class)
instead, if your key
is non-unique.
key
- The key. Client code must assure that key is unique in the
result set.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(Field, Class)
<E> Map<?,E> fetchMap(int keyFieldIndex, RecordMapper<? super R,E> mapper) throws DataAccessException
Map
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.
keyFieldIndex
- The key. Client code must assure that key is unique
in the result set.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(int, Class)
<E> Map<?,E> fetchMap(String keyFieldName, RecordMapper<? super R,E> mapper) throws DataAccessException
Map
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(String, Class)
instead, if your key
is non-unique.
keyFieldName
- The key. Client code must assure that key is unique
in the result set.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(String, Class)
<E> Map<?,E> fetchMap(Name keyFieldName, RecordMapper<? super R,E> mapper) throws DataAccessException
Map
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(Name, Class)
instead, if your key
is non-unique.
keyFieldName
- The key. Client code must assure that key is unique
in the result set.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryInvalidResultException
- if the key is non-unique in the result
set.Result.intoMap(Name, Class)
<K> Map<K,Result<R>> fetchGroups(Field<K> key) throws DataAccessException
Map
with one of the result's
columns as key and a list of corresponding records as value.
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. Use Settings.isAttachRecords()
to override this
behaviour.
K
- The key's generic field typekey
- The key field.DataAccessException
- if something went wrong executing the queryResult.intoGroups(Field)
Map<?,Result<R>> fetchGroups(int keyFieldIndex) throws DataAccessException
Map
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. Use Settings.isAttachRecords()
to override this
behaviour.
keyFieldIndex
- The key field index.DataAccessException
- if something went wrong executing the queryResult.intoGroups(int)
Map<?,Result<R>> fetchGroups(String keyFieldName) throws DataAccessException
Map
with one of the result's
columns as key and a list of corresponding records as value.
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. Use Settings.isAttachRecords()
to override this
behaviour.
keyFieldName
- The key field name.DataAccessException
- if something went wrong executing the queryResult.intoGroups(String)
Map<?,Result<R>> fetchGroups(Name keyFieldName) throws DataAccessException
Map
with one of the result's
columns as key and a list of corresponding records as value.
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. Use Settings.isAttachRecords()
to override this
behaviour.
keyFieldName
- The key field name.DataAccessException
- if something went wrong executing the queryResult.intoGroups(Name)
<K,V> Map<K,List<V>> fetchGroups(Field<K> key, Field<V> value) throws DataAccessException
Map
with one of the result's
columns as key and another one of the result's columns as value
Unlike fetchMap(Field, Field)
, this method allows for non-unique
keys in the result set.
K
- The key's generic field typeV
- The value's generic field typekey
- The key field.value
- The value fieldDataAccessException
- if something went wrong executing the queryResult.intoGroups(Field, Field)
Map<?,List<?>> fetchGroups(int keyFieldIndex, int valueFieldIndex) throws DataAccessException
Map
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.
keyFieldIndex
- The key field index.valueFieldIndex
- The value field index.DataAccessException
- if something went wrong executing the queryResult.intoGroups(int, int)
Map<?,List<?>> fetchGroups(String keyFieldName, String valueFieldName) throws DataAccessException
Map
with one of the result's
columns as key and another one of the result's columns as value
Unlike fetchMap(String, String)
, this method allows for
non-unique keys in the result set.
keyFieldName
- The key field name.valueFieldName
- The value field name.DataAccessException
- if something went wrong executing the queryResult.intoGroups(String, String)
Map<?,List<?>> fetchGroups(Name keyFieldName, Name valueFieldName) throws DataAccessException
Map
with one of the result's
columns as key and another one of the result's columns as value
Unlike fetchMap(Name, Name)
, this method allows for
non-unique keys in the result set.
keyFieldName
- The key field name.valueFieldName
- The value field name.DataAccessException
- if something went wrong executing the queryResult.intoGroups(Name, Name)
Map<Record,Result<R>> fetchGroups(Field<?>[] keys) throws DataAccessException
Map
with the result grouped by the
given keys.
Unlike fetchMap(Field[])
, this method allows for non-unique keys
in the result set.
keys
- The keys used for result grouping. If this is
null
or an empty array, the resulting map will
contain at most one entry.DataAccessException
- if something went wrong executing the queryResult.intoGroups(Field[])
Map<Record,Result<R>> fetchGroups(int[] keyFieldIndexes) throws DataAccessException
Map
with the result grouped by the
given keys.
Unlike fetchMap(int[])
, this method allows for non-unique keys
in the result set.
keyFieldIndexes
- The keys used for result grouping. If this is
null
or an empty array, the resulting map will
contain at most one entry.DataAccessException
- if something went wrong executing the queryResult.intoGroups(int[])
Map<Record,Result<R>> fetchGroups(String[] keyFieldNames) throws DataAccessException
Map
with the result grouped by the
given keys.
Unlike fetchMap(String[])
, this method allows for non-unique
keys in the result set.
keyFieldNames
- The keys used for result grouping. If this is
null
or an empty array, the resulting map will
contain at most one entry.DataAccessException
- if something went wrong executing the queryResult.intoGroups(String[])
Map<Record,Result<R>> fetchGroups(Name[] keyFieldNames) throws DataAccessException
Map
with the result grouped by the
given keys.
Unlike fetchMap(Name[])
, this method allows for non-unique
keys in the result set.
keyFieldNames
- The keys used for result grouping. If this is
null
or an empty array, the resulting map will
contain at most one entry.DataAccessException
- if something went wrong executing the queryResult.intoGroups(Name[])
<E> Map<Record,List<E>> fetchGroups(Field<?>[] keys, Class<? extends E> type) throws MappingException
Map
with results grouped by the
given keys and mapped into the given entity type.
Unlike fetchMap(Field[], Class)
, this method allows for
non-unique keys in the result set.
keys
- The keys. If this is null
or an empty array, the
resulting map will contain at most one entry.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Field[], Class)
,
DefaultRecordMapper
<E> Map<Record,List<E>> fetchGroups(int[] keyFieldIndexes, Class<? extends E> type) throws MappingException
Map
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.
keyFieldIndexes
- The keys. If this is null
or an empty
array, the resulting map will contain at most one entry.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(int[], Class)
,
DefaultRecordMapper
<E> Map<Record,List<E>> fetchGroups(String[] keyFieldNames, Class<? extends E> type) throws MappingException
Map
with results grouped by the
given keys and mapped into the given entity type.
Unlike fetchMap(String[], Class)
, this method allows for
non-unique keys in the result set.
keyFieldNames
- The keys. If this is null
or an empty
array, the resulting map will contain at most one entry.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(String[], Class)
,
DefaultRecordMapper
<E> Map<Record,List<E>> fetchGroups(Name[] keyFieldNames, Class<? extends E> type) throws MappingException
Map
with results grouped by the
given keys and mapped into the given entity type.
Unlike fetchMap(Name[], Class)
, this method allows for
non-unique keys in the result set.
keyFieldNames
- The keys. If this is null
or an empty
array, the resulting map will contain at most one entry.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Name[], Class)
,
DefaultRecordMapper
<E> Map<Record,List<E>> fetchGroups(Field<?>[] keys, RecordMapper<? super R,E> mapper) throws MappingException
Map
with results grouped by the
given keys and mapped by the given mapper.
Unlike fetchMap(Field[], RecordMapper)
, this method allows for
non-unique keys in the result set.
keys
- The keys. If this is null
or an empty array, the
resulting map will contain at most one entry.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Field[], Class)
,
DefaultRecordMapper
<E> Map<Record,List<E>> fetchGroups(int[] keyFieldIndexes, RecordMapper<? super R,E> mapper) throws MappingException
Map
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.
keyFieldIndexes
- The keys. If this is null
or an empty
array, the resulting map will contain at most one entry.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(int[], Class)
,
DefaultRecordMapper
<E> Map<Record,List<E>> fetchGroups(String[] keyFieldNames, RecordMapper<? super R,E> mapper) throws MappingException
Map
with results grouped by the
given keys and mapped by the given mapper.
Unlike fetchMap(String[], RecordMapper)
, this method allows for
non-unique keys in the result set.
keyFieldNames
- The keys. If this is null
or an empty
array, the resulting map will contain at most one entry.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(String[], Class)
,
DefaultRecordMapper
<E> Map<Record,List<E>> fetchGroups(Name[] keyFieldNames, RecordMapper<? super R,E> mapper) throws MappingException
Map
with results grouped by the
given keys and mapped by the given mapper.
Unlike fetchMap(Name[], RecordMapper)
, this method allows for
non-unique keys in the result set.
keyFieldNames
- The keys. If this is null
or an empty
array, the resulting map will contain at most one entry.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Name[], Class)
,
DefaultRecordMapper
<K> Map<K,Result<R>> fetchGroups(Class<? extends K> keyType) throws MappingException
Map
with results grouped by the
given key entity.
The grouping semantics is governed by the key type's
Object.equals(Object)
and Object.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.
keyType
- The key type. If this is null
, the resulting
map will contain at most one entry.MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsDefaultRecordMapper
<K,V> Map<K,List<V>> fetchGroups(Class<? extends K> keyType, Class<? extends V> valueType) throws MappingException
Map
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)
and Object.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.
keyType
- The key type. If this is null
, the resulting
map will contain at most one entry.valueType
- The value type.MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsDefaultRecordMapper
<K,V> Map<K,List<V>> fetchGroups(Class<? extends K> keyType, RecordMapper<? super R,V> valueMapper) throws MappingException
Map
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)
and Object.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.
keyType
- The key type. If this is null
, the resulting
map will contain at most one entry.valueMapper
- The value mapper.MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsDefaultRecordMapper
<K> Map<K,Result<R>> fetchGroups(RecordMapper<? super R,K> keyMapper) throws MappingException
Map
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)
and Object.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.
keyMapper
- The key mapper.MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsDefaultRecordMapper
<K,V> Map<K,List<V>> fetchGroups(RecordMapper<? super R,K> keyMapper, Class<V> valueType) throws MappingException
Map
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)
and Object.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.
keyMapper
- The key mapper.valueType
- The value type.MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsDefaultRecordMapper
<K,V> Map<K,List<V>> fetchGroups(RecordMapper<? super R,K> keyMapper, RecordMapper<? super R,V> valueMapper) throws MappingException
Map
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)
and Object.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.
keyMapper
- The key mapper.valueMapper
- The value mapper.MappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsDefaultRecordMapper
<S extends Record> Map<S,Result<R>> fetchGroups(Table<S> table) throws DataAccessException
Map
with the result grouped by the
given table.
Unlike fetchMap(Table)
, this method allows for non-unique keys
in the result set.
table
- The key table. May not be null
.DataAccessException
- if something went wrong executing the queryResult.intoGroups(Field[])
<E,S extends Record> Map<S,List<E>> fetchGroups(Table<S> table, Class<? extends E> type) throws DataAccessException, MappingException
Map
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.
table
- The key table. May not be null
.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Table, Class)
,
DefaultRecordMapper
<E,S extends Record> Map<S,List<E>> fetchGroups(Table<S> table, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
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.
table
- The key table. May not be null
.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Table, Class)
,
DefaultRecordMapper
<K,E> Map<K,List<E>> fetchGroups(Field<K> key, Class<? extends E> type) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped
into the given entity type.K
- The key's generic field typeE
- The generic entity type.key
- The key field.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Field, Class)
,
DefaultRecordMapper
<E> Map<?,List<E>> fetchGroups(int keyFieldIndex, Class<? extends E> type) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped
into the given entity type.keyFieldIndex
- The key field index.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(int, Class)
,
DefaultRecordMapper
<E> Map<?,List<E>> fetchGroups(String keyFieldName, Class<? extends E> type) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped
into the given entity type.keyFieldName
- The key field name.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(String, Class)
,
DefaultRecordMapper
<E> Map<?,List<E>> fetchGroups(Name keyFieldName, Class<? extends E> type) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped
into the given entity type.keyFieldName
- The key field name.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Name, Class)
,
DefaultRecordMapper
<K,E> Map<K,List<E>> fetchGroups(Field<K> key, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped by
the given mapper.K
- The key's generic field typeE
- The generic entity type.key
- The key field.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Field, Class)
,
DefaultRecordMapper
<E> Map<?,List<E>> fetchGroups(int keyFieldIndex, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped by
the given mapper.keyFieldIndex
- The key field index.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(int, Class)
,
DefaultRecordMapper
<E> Map<?,List<E>> fetchGroups(String keyFieldName, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped by
the given mapper.keyFieldName
- The key field name.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(String, Class)
,
DefaultRecordMapper
<E> Map<?,List<E>> fetchGroups(Name keyFieldName, RecordMapper<? super R,E> mapper) throws DataAccessException, MappingException
Map
with results grouped by the given key and mapped by
the given mapper.keyFieldName
- The key field name.mapper
- The mapper callback.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsResult.intoGroups(Name, Class)
,
DefaultRecordMapper
Object[][] fetchArrays() throws DataAccessException
You can access data like this
query.fetchArray()[recordIndex][fieldIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArrays()
R[] fetchArray() throws DataAccessException
DataAccessException
- if something went wrong executing the queryList.toArray(Object[])
Object[] fetchArray(int fieldIndex) throws DataAccessException
You can access data like this
query.fetchArray(fieldIndex)[recordIndex]
Object[]
, depending on whether jOOQ has any
knowledge about fieldIndex
's actual type.DataAccessException
- if something went wrong executing the queryResult.intoArray(int)
<T> T[] fetchArray(int fieldIndex, Class<? extends T> type) throws DataAccessException
You can access data like this
query.fetchArray(fieldIndex)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(int, Class)
<U> U[] fetchArray(int fieldIndex, Converter<?,U> converter) throws DataAccessException
You can access data like this
query.fetchArray(fieldIndex)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(int, Converter)
Object[] fetchArray(String fieldName) throws DataAccessException
You can access data like this
query.fetchArray(fieldName)[recordIndex]
Object[]
, depending on whether jOOQ has any
knowledge about fieldName
's actual type.DataAccessException
- if something went wrong executing the queryResult.intoArray(String)
<T> T[] fetchArray(String fieldName, Class<? extends T> type) throws DataAccessException
You can access data like this
query.fetchArray(fieldName)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(String, Converter)
<U> U[] fetchArray(String fieldName, Converter<?,U> converter) throws DataAccessException
You can access data like this
query.fetchArray(fieldName)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(String, Class)
Object[] fetchArray(Name fieldName) throws DataAccessException
You can access data like this
query.fetchArray(fieldName)[recordIndex]
Object[]
, depending on whether jOOQ has any
knowledge about fieldName
's actual type.DataAccessException
- if something went wrong executing the queryResult.intoArray(Name)
<T> T[] fetchArray(Name fieldName, Class<? extends T> type) throws DataAccessException
You can access data like this
query.fetchArray(fieldName)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(Name, Converter)
<U> U[] fetchArray(Name fieldName, Converter<?,U> converter) throws DataAccessException
You can access data like this
query.fetchArray(fieldName)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(Name, Class)
<T> T[] fetchArray(Field<T> field) throws DataAccessException
You can access data like this
query.fetchArray(field)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(Field)
<T> T[] fetchArray(Field<?> field, Class<? extends T> type) throws DataAccessException
You can access data like this
query.fetchArray(field)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(Field, Class)
<T,U> U[] fetchArray(Field<T> field, Converter<? super T,U> converter) throws DataAccessException
You can access data like this
query.fetchArray(field)[recordIndex]
DataAccessException
- if something went wrong executing the queryResult.intoArray(Field, Converter)
Set<?> fetchSet(int fieldIndex) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(int)
<T> Set<T> fetchSet(int fieldIndex, Class<? extends T> type) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(int, Class)
<U> Set<U> fetchSet(int fieldIndex, Converter<?,U> converter) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(int, Converter)
Set<?> fetchSet(String fieldName) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(String)
<T> Set<T> fetchSet(String fieldName, Class<? extends T> type) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(String, Converter)
<U> Set<U> fetchSet(String fieldName, Converter<?,U> converter) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(String, Class)
Set<?> fetchSet(Name fieldName) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(Name)
<T> Set<T> fetchSet(Name fieldName, Class<? extends T> type) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(Name, Converter)
<U> Set<U> fetchSet(Name fieldName, Converter<?,U> converter) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(Name, Class)
<T> Set<T> fetchSet(Field<T> field) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(Field)
<T> Set<T> fetchSet(Field<?> field, Class<? extends T> type) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(Field, Class)
<T,U> Set<U> fetchSet(Field<T> field, Converter<? super T,U> converter) throws DataAccessException
DataAccessException
- if something went wrong executing the queryResult.intoArray(Field, Converter)
<E> List<E> fetchInto(Class<? extends E> type) throws DataAccessException, MappingException
This is the same as calling fetch().into(type)
. See
Record.into(Class)
for more details
E
- The generic entity type.type
- The entity type.DataAccessException
- if something went wrong executing the queryMappingException
- wrapping any reflection or data type conversion
exception that might have occurred while mapping recordsRecord.into(Class)
,
Result.into(Class)
,
DefaultRecordMapper
<Z extends Record> Result<Z> fetchInto(Table<Z> table) throws DataAccessException
This is the same as calling fetch().into(table)
. See
Record.into(Table)
for more details
The result and its contained records are attached to the original
Configuration
by default. Use Settings.isAttachRecords()
to override this behaviour.
Z
- The generic table record type.table
- The table type.DataAccessException
- if something went wrong executing the queryRecord.into(Table)
,
Result.into(Table)
<H extends RecordHandler<? super R>> H fetchInto(H handler) throws DataAccessException
The resulting records are attached to the original Configuration
by default. Use Settings.isAttachRecords()
to override this
behaviour.
handler
- The handler callbackDataAccessException
- if something went wrong executing the query<E> List<E> fetch(RecordMapper<? super R,E> mapper) throws DataAccessException
mapper
- The mapper callbackDataAccessException
- if something went wrong executing the query@Deprecated FutureResult<R> fetchLater() throws DataAccessException
This method wraps fetching of records in a
Future
, such that you can access the actual
records at a future instant. This is especially useful when
This will internally create a "single thread executor", that is shut down
at the end of the FutureResult
's lifecycle. Use
fetchLater(ExecutorService)
instead, if you want control over
your executing threads.
The result and its contained records are attached to the original
Configuration
by default. Use Settings.isAttachRecords()
to override this behaviour.
DataAccessException
- if something went wrong executing the query@Deprecated FutureResult<R> fetchLater(ExecutorService executor) throws DataAccessException
This method wraps fetching of records in a
Future
, such that you can access the actual
records at a future instant. This is especially useful when
Use this method rather than fetchLater()
, in order to keep
control over thread lifecycles, if you manage threads in a J2EE container
or with Spring, for instance.
The result and its contained records are attached to the original
Configuration
by default. Use Settings.isAttachRecords()
to override this behaviour.
executor
- A custom executorDataAccessException
- if something went wrong executing the queryResultQuery<R> bind(String param, Object value) throws IllegalArgumentException, DataTypeException
[#1886] If the bind value with name param
is inlined (
Param.isInline()
) or if this query was created with
StatementType.STATIC_STATEMENT
and there is an underlying
PreparedStatement
kept open because of
Query.keepStatement(boolean)
, the underlying
PreparedStatement
will be closed automatically in order for
new bind values to have an effect.
bind
in interface Query
param
- The named parameter name. If this is a number, then this is
the same as calling Query.bind(int, Object)
value
- The new bind value.IllegalArgumentException
- if there is no parameter by the given
parameter name or index.DataTypeException
- if value
cannot be converted into
the parameter's data typeResultQuery<R> bind(int index, Object value) throws IllegalArgumentException, DataTypeException
[#1886] If the bind value at index
is inlined (
Param.isInline()
) or if this query was created with
StatementType.STATIC_STATEMENT
and there is an underlying
PreparedStatement
kept open because of
Query.keepStatement(boolean)
, the underlying
PreparedStatement
will be closed automatically in order for
new bind values to have an effect.
bind
in interface Query
index
- The parameter index, starting with 1value
- The new bind value.IllegalArgumentException
- if there is no parameter by the given
parameter index.DataTypeException
- if value
cannot be converted into
the parameter's data typeResultQuery<R> queryTimeout(int timeout)
Statement
.queryTimeout
in interface Query
Statement.setQueryTimeout(int)
ResultQuery<R> keepStatement(boolean keepStatement)
This indicates to jOOQ that the query's underlying Statement
or
PreparedStatement
should be kept open after execution. If it is
kept open, client code is responsible for properly closing it using
Query.close()
keepStatement
in interface Query
keepStatement
- Whether to keep the underlying statement openResultQuery<R> maxRows(int rows)
Statement
.
This is not the same as setting a LIMIT .. OFFSET
clause
onto the statement, where the result set is restricted within the
database.
Statement.setMaxRows(int)
ResultQuery<R> fetchSize(int rows)
Statement
.
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:
Integer.MIN_VALUE
as an indicator to fetch
resulting rows row-by-row in conjunction with
ResultSet.TYPE_FORWARD_ONLY
(set in resultSetType(int)
)
and ResultSet.CONCUR_READ_ONLY
(set in
resultSetConcurrency(int)
). See
this page here for details.Connection.getAutoCommit()
== true
. For more
information, see this page hereStatement.setFetchSize(int)
ResultQuery<R> resultSetConcurrency(int resultSetConcurrency)
ResultSet
concurrency of ResultSet
objects created by jOOQ.
This will affect the way you may perceive ResultSet
objects
obtained from any of these methods:
Statement.getResultSetConcurrency()
ResultQuery<R> resultSetType(int resultSetType)
ResultSet
type of ResultSet
objects created by jOOQ.
This will affect the way you may perceive ResultSet
objects
obtained from any of these methods:
Statement.getResultSetType()
ResultQuery<R> resultSetHoldability(int resultSetHoldability)
ResultSet
holdability of ResultSet
objects created by jOOQ.
This will affect the way you may perceive ResultSet
objects
obtained from any of these methods:
Statement.getResultSetHoldability()
ResultQuery<R> intern(Field<?>... fields)
Unlike Result
's intern()
methods, this already
interns values right after fetching them from a JDBC result set. See
Result.intern(int...)
for more details.
fields
- The fields whose values should be internedResult.intern(Field...)
,
String.intern()
ResultQuery<R> intern(int... fieldIndexes)
Unlike Result
's intern()
methods, this already
interns values right after fetching them from a JDBC result set. See
Result.intern(int...)
for more details.
fieldIndexes
- The field indexes whose values should be internedResult.intern(int...)
,
String.intern()
ResultQuery<R> intern(String... fieldNames)
Unlike Result
's intern()
methods, this already
interns values right after fetching them from a JDBC result set. See
Result.intern(String...)
for more details.
fieldNames
- The field names whose values should be internedResult.intern(String...)
,
String.intern()
ResultQuery<R> intern(Name... fieldNames)
Unlike Result
's intern()
methods, this already
interns values right after fetching them from a JDBC result set. See
Result.intern(Name...)
for more details.
fieldNames
- The field names whose values should be internedResult.intern(Name...)
,
String.intern()
Copyright © 2015. All Rights Reserved.