public interface Record extends Attachable, java.lang.Comparable<Record>
A record essentially combines a list of columns (Field
) with a
corresponding list of values, each value being of the respective field's
type.
While records can be seen as generic column / value mappings, their concrete implementations often specialise the above description in any of the following ways:
Records originating from a concrete database table (or view) are modelled by
jOOQ as TableRecord
or UpdatableRecord
, if they contain a
primary key. If you're using jOOQ's code generator, you can generate even
more concrete types of table records, i.e. one table record per table.
SQLDialect.ORACLE
and SQLDialect.POSTGRES
formally support
user defined types (UDT), which are modelled by jOOQ as UDTRecord
. In
addition to being regular records (column / value mappings), they also
implement the JDBC SQLData
API in order to be streamed to a JDBC
PreparedStatement
or from a JDBC ResultSet
When projecting custom record types in SQL, new ad-hoc types of a certain
degree are formed on the fly. Records with degree <= 22 are reflected by
jOOQ through the Record1
, Record2
, ... Record22
classes, which cover the respective row value expressions Row1
,
Row2
, ... Row22
Note that generated TableRecords
and UDTRecords
also implement a Record[N]
interface, if N <= 22
jOOQ records have a natural ordering implemented in the same way as this is
defined in the SQL standard. For more details, see the
compareTo(Record)
method
Result
Modifier and Type | Method and Description |
---|---|
boolean |
changed()
Check if this record has been changed from its original as fetched from
the database.
|
void |
changed(boolean changed)
Set all of this record's internal changed flags to the supplied value.
|
boolean |
changed(Field<?> field)
Check if a field's value has been changed from its original as fetched
from the database.
|
void |
changed(Field<?> field,
boolean changed)
Set this record's internal changed flag to the supplied value for a given
field.
|
boolean |
changed(int fieldIndex)
Check if a field's value has been changed from its original as fetched
from the database.
|
void |
changed(int fieldIndex,
boolean changed)
Set this record's internal changed flag to the supplied value for a given
field.
|
boolean |
changed(java.lang.String fieldName)
Check if a field's value has been changed from its original as fetched
from the database.
|
void |
changed(java.lang.String fieldName,
boolean changed)
Set this record's internal changed flag to the supplied value for a given
field.
|
int |
compareTo(Record record)
Compares this
Record with another Record
according to their natural ordering. |
boolean |
equals(java.lang.Object other)
Compare this
Record with another Record for
equality. |
<T> Field<T> |
field(Field<T> field)
Get a specific field from this Record.
|
Field<?> |
field(int index)
Get a specific field from this Record.
|
Field<?> |
field(java.lang.String name)
Get a specific field from this Record.
|
Field<?>[] |
fields()
Get all fields from this Record.
|
Field<?>[] |
fields(Field<?>... fields)
Get all fields from this Record, providing some fields.
|
Field<?>[] |
fields(int... fieldIndexes)
Get all fields from this Record, providing some field indexes.
|
Field<?>[] |
fields(java.lang.String... fieldNames)
Get all fields from this Record, providing some field names.
|
Row |
fieldsRow()
Get this record's fields as a
Row . |
void |
from(java.lang.Object source)
Load data into this record from a source.
|
void |
from(java.lang.Object source,
Field<?>... fields)
Load data into this record from a source, providing some fields.
|
void |
from(java.lang.Object source,
int... fieldIndexes)
Load data into this record from a source, providing some field indexes.
|
void |
from(java.lang.Object source,
java.lang.String... fieldNames)
Load data into this record from a source, providing some field names.
|
void |
fromArray(java.lang.Object... array)
Load data from an array into this record.
|
void |
fromArray(java.lang.Object[] array,
Field<?>... fields)
Load data from an array into this record, providing some fields.
|
void |
fromArray(java.lang.Object[] array,
int... fieldIndexes)
Load data from an array into this record, providing some fields indexes.
|
void |
fromArray(java.lang.Object[] array,
java.lang.String... fieldNames)
Load data from an array into this record, providing some fields names.
|
void |
fromMap(java.util.Map<java.lang.String,?> map)
Load data from a map into this record.
|
void |
fromMap(java.util.Map<java.lang.String,?> map,
Field<?>... fields)
Load data from a map into this record, providing some fields.
|
void |
fromMap(java.util.Map<java.lang.String,?> map,
int... fieldIndexes)
Load data from a map into this record, providing some field indexes.
|
void |
fromMap(java.util.Map<java.lang.String,?> map,
java.lang.String... fieldNames)
Load data from a map into this record, providing some field names.
|
<T> T |
getValue(Field<?> field,
java.lang.Class<? extends T> type)
Get a converted value from this Record, providing a field.
|
<T> T |
getValue(Field<?> field,
java.lang.Class<? extends T> type,
T defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
<T> T |
getValue(Field<T> field)
Get a value from this Record, providing a field.
|
<T,U> U |
getValue(Field<T> field,
Converter<? super T,U> converter)
Get a converted value from this Record, providing a field.
|
<T,U> U |
getValue(Field<T> field,
Converter<? super T,U> converter,
U defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
<T> T |
getValue(Field<T> field,
T defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
java.lang.Object |
getValue(int index)
Get a value from this record, providing a field index.
|
<T> T |
getValue(int index,
java.lang.Class<? extends T> type)
Get a converted value from this record, providing a field index.
|
<T> T |
getValue(int index,
java.lang.Class<? extends T> type,
T defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
<U> U |
getValue(int index,
Converter<?,U> converter)
Get a converted value from this record, providing a field index.
|
<U> U |
getValue(int index,
Converter<?,U> converter,
U defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
java.lang.Object |
getValue(int index,
java.lang.Object defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
java.lang.Object |
getValue(java.lang.String fieldName)
Get a value from this Record, providing a field name.
|
<T> T |
getValue(java.lang.String fieldName,
java.lang.Class<? extends T> type)
Get a converted value from this Record, providing a field name.
|
<T> T |
getValue(java.lang.String fieldName,
java.lang.Class<? extends T> type,
T defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
<U> U |
getValue(java.lang.String fieldName,
Converter<?,U> converter)
Get a converted value from this Record, providing a field name.
|
<U> U |
getValue(java.lang.String fieldName,
Converter<?,U> converter,
U defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
java.lang.Object |
getValue(java.lang.String fieldName,
java.lang.Object defaultValue)
Deprecated.
- 3.3.0 - [#2878] - This method will be removed in jOOQ 4.0
|
int |
hashCode()
Get a hash code of this
Record , based on the underlying row
value expression. |
<E> E |
into(java.lang.Class<? extends E> type)
Map resulting records onto a custom type.
|
<E> E |
into(E object)
Map resulting records onto a custom type.
|
Record |
into(Field<?>... fields)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1> Record1<T1> |
into(Field<T1> field1)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2> Record2<T1,T2> |
into(Field<T1> field1,
Field<T2> field2)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3> Record3<T1,T2,T3> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15,
Field<T16> field16)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15,
Field<T16> field16,
Field<T17> field17)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15,
Field<T16> field16,
Field<T17> field17,
Field<T18> field18)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15,
Field<T16> field16,
Field<T17> field17,
Field<T18> field18,
Field<T19> field19)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15,
Field<T16> field16,
Field<T17> field17,
Field<T18> field18,
Field<T19> field19,
Field<T20> field20)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15,
Field<T16> field16,
Field<T17> field17,
Field<T18> field18,
Field<T19> field19,
Field<T20> field20,
Field<T21> field21)
Copy this record into a new record holding only a subset of the previous
fields.
|
<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22> |
into(Field<T1> field1,
Field<T2> field2,
Field<T3> field3,
Field<T4> field4,
Field<T5> field5,
Field<T6> field6,
Field<T7> field7,
Field<T8> field8,
Field<T9> field9,
Field<T10> field10,
Field<T11> field11,
Field<T12> field12,
Field<T13> field13,
Field<T14> field14,
Field<T15> field15,
Field<T16> field16,
Field<T17> field17,
Field<T18> field18,
Field<T19> field19,
Field<T20> field20,
Field<T21> field21,
Field<T22> field22)
Copy this record into a new record holding only a subset of the previous
fields.
|
<R extends Record> |
into(Table<R> table)
Map resulting records onto a custom record type.
|
java.lang.Object[] |
intoArray()
Convert this record into an array.
|
java.util.List<java.lang.Object> |
intoList()
Convert this record into a list.
|
java.util.Map<java.lang.String,java.lang.Object> |
intoMap()
Return this record as a name/value map.
|
java.sql.ResultSet |
intoResultSet()
Generate an in-memory JDBC
ResultSet containing the data of this
Record . |
<E> E |
map(RecordMapper<Record,E> mapper)
Map this record into a custom mapper callback.
|
Record |
original()
Get this record containing the original values as fetched from the
database.
|
<T> T |
original(Field<T> field)
Get an original value from this record as fetched from the database.
|
java.lang.Object |
original(int fieldIndex)
Get an original value from this record as fetched from the database.
|
java.lang.Object |
original(java.lang.String fieldName)
Get an original value from this record as fetched from the database.
|
void |
reset()
|
void |
reset(Field<?> field)
|
void |
reset(int fieldIndex)
|
void |
reset(java.lang.String fieldName)
|
<T> void |
setValue(Field<T> field,
T value)
Set a value into this record.
|
<T,U> void |
setValue(Field<T> field,
U value,
Converter<T,? super U> converter)
Set a value into this record.
|
int |
size()
Get the number of fields of this record.
|
Row |
valuesRow()
Get this record's values as a
Row . |
attach, detach
<T> Field<T> field(Field<T> field)
Row.field(Field)
Field<?> field(java.lang.String name)
Row.field(String)
Field<?> field(int index)
Row.field(int)
Field<?>[] fields()
Row.fields()
Field<?>[] fields(Field<?>... fields)
Row.fields(Field...)
Field<?>[] fields(java.lang.String... fieldNames)
Row.fields(String...)
Field<?>[] fields(int... fieldIndexes)
Row.fields(int...)
<T> T getValue(Field<T> field) throws java.lang.IllegalArgumentException
If this record contains a field with the same Field.getName()
as
the argument field, that value is retrieved.
T
- The generic field parameterfield
- The fieldjava.lang.IllegalArgumentException
- If the argument field is not contained
in fieldsRow()
@Deprecated <T> T getValue(Field<T> field, T defaultValue) throws java.lang.IllegalArgumentException
T
- The generic field parameterfield
- The fielddefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument field is not contained
in fieldsRow()
<T> T getValue(Field<?> field, java.lang.Class<? extends T> type) throws java.lang.IllegalArgumentException, DataTypeException
If this record contains a field with the same Field.getName()
as
the argument field, that value is retrieved.
T
- The conversion type parameterfield
- The fieldtype
- The conversion typejava.lang.IllegalArgumentException
- If the argument field is not contained
in fieldsRow()
DataTypeException
- wrapping any data type conversion exception
that might have occurredDataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Class)
@Deprecated <T> T getValue(Field<?> field, java.lang.Class<? extends T> type, T defaultValue) throws java.lang.IllegalArgumentException, DataTypeException
T
- The conversion type parameterfield
- The fieldtype
- The conversion typedefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument field is not contained
in fieldsRow()
DataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Class)
<T,U> U getValue(Field<T> field, Converter<? super T,U> converter) throws java.lang.IllegalArgumentException, DataTypeException
If this record contains a field with the same Field.getName()
as
the argument field, that value is retrieved.
T
- The database type parameterU
- The conversion type parameterfield
- The fieldconverter
- The data type converterjava.lang.IllegalArgumentException
- If the argument field is not contained
in fieldsRow()
DataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Converter)
@Deprecated <T,U> U getValue(Field<T> field, Converter<? super T,U> converter, U defaultValue) throws java.lang.IllegalArgumentException, DataTypeException
T
- The database type parameterU
- The conversion type parameterfield
- The fieldconverter
- The data type converterdefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument field is not contained
in fieldsRow()
DataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Converter)
java.lang.Object getValue(java.lang.String fieldName) throws java.lang.IllegalArgumentException
fieldName
- The field's namejava.lang.IllegalArgumentException
- If the argument fieldName is not
contained in the record@Deprecated java.lang.Object getValue(java.lang.String fieldName, java.lang.Object defaultValue) throws java.lang.IllegalArgumentException
fieldName
- The field's namedefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument fieldName is not
contained in the record<T> T getValue(java.lang.String fieldName, java.lang.Class<? extends T> type) throws java.lang.IllegalArgumentException, DataTypeException
T
- The conversion type parameterfieldName
- The field's nametype
- The conversion typejava.lang.IllegalArgumentException
- If the argument fieldName is not
contained in the recordDataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Class)
@Deprecated <T> T getValue(java.lang.String fieldName, java.lang.Class<? extends T> type, T defaultValue) throws java.lang.IllegalArgumentException, DataTypeException
T
- The conversion type parameterfieldName
- The field's nametype
- The conversion typedefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument fieldName is not
contained in the recordDataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Class)
<U> U getValue(java.lang.String fieldName, Converter<?,U> converter) throws java.lang.IllegalArgumentException, DataTypeException
U
- The conversion type parameterfieldName
- The field's nameconverter
- The data type converterjava.lang.IllegalArgumentException
- If the argument fieldName is not
contained in the recordDataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Converter)
@Deprecated <U> U getValue(java.lang.String fieldName, Converter<?,U> converter, U defaultValue) throws java.lang.IllegalArgumentException, DataTypeException
U
- The conversion type parameterfieldName
- The field's nameconverter
- The data type converterdefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument fieldName is not
contained in the recordDataTypeException
- wrapping any data type conversion exception
that might have occurredConvert.convert(Object, Converter)
java.lang.Object getValue(int index) throws java.lang.IllegalArgumentException
index
- The field's indexjava.lang.IllegalArgumentException
- If the argument index is not contained
in the record@Deprecated java.lang.Object getValue(int index, java.lang.Object defaultValue) throws java.lang.IllegalArgumentException
index
- The field's indexdefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument index is not contained
in the record<T> T getValue(int index, java.lang.Class<? extends T> type) throws java.lang.IllegalArgumentException, DataTypeException
T
- The conversion type parameterindex
- The field's indextype
- The conversion typejava.lang.IllegalArgumentException
- If the argument index is not contained
in the recordDataTypeException
- wrapping data type conversion exception that
might have occurredConvert.convert(Object, Class)
@Deprecated <T> T getValue(int index, java.lang.Class<? extends T> type, T defaultValue) throws java.lang.IllegalArgumentException, DataTypeException
T
- The conversion type parameterindex
- The field's indextype
- The conversion typedefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument index is not contained
in the recordDataTypeException
- wrapping data type conversion exception that
might have occurredConvert.convert(Object, Class)
<U> U getValue(int index, Converter<?,U> converter) throws java.lang.IllegalArgumentException, DataTypeException
U
- The conversion type parameterindex
- The field's indexconverter
- The data type converterjava.lang.IllegalArgumentException
- If the argument index is not contained
in the recordDataTypeException
- wrapping data type conversion exception that
might have occurredConvert.convert(Object, Converter)
@Deprecated <U> U getValue(int index, Converter<?,U> converter, U defaultValue) throws java.lang.IllegalArgumentException, DataTypeException
U
- The conversion type parameterindex
- The field's indexconverter
- The data type converterdefaultValue
- The default value instead of null
null
java.lang.IllegalArgumentException
- If the argument index is not contained
in the recordDataTypeException
- wrapping data type conversion exception that
might have occurredConvert.convert(Object, Converter)
<T> void setValue(Field<T> field, T value)
This will always set the changed(Field)
flag for the given
field
, no matter if setting the value actually changes the
value.
Changing Table.getPrimaryKey()
values will set all
changed()
flags to true, in order to produce complete
INSERT
statements on subsequent
UpdatableRecord.store()
operations.
T
- The generic field parameterfield
- The fieldvalue
- The value<T,U> void setValue(Field<T> field, U value, Converter<T,? super U> converter)
This will always set the changed(Field)
flag for the given
field
, no matter if setting the value actually changes the
value.
Changing Table.getPrimaryKey()
values will set all
changed()
flags to true, in order to produce complete
INSERT
statements on subsequent
UpdatableRecord.store()
operations.
T
- The generic field parameterU
- The conversion type parameterfield
- The fieldvalue
- The valueconverter
- The converter used to convert value
into an
appropriate typeint size()
Record original()
Record values can be freely modified after having fetched a record from the database. Every record also references the originally fetched values. This method returns a new record containing those original values.
original(Field)
,
original(int)
,
original(String)
<T> T original(Field<T> field)
Record values can be freely modified after having fetched a record from the database. Every record also references the originally fetched values. This method returns such an original value for a field.
original()
java.lang.Object original(int fieldIndex)
Record values can be freely modified after having fetched a record from the database. Every record also references the originally fetched values. This method returns such an original value for a field.
original()
java.lang.Object original(java.lang.String fieldName)
Record values can be freely modified after having fetched a record from the database. Every record also references the originally fetched values. This method returns such an original value for a field.
original()
boolean changed()
If this returns false
, then it can be said that
record.equals(record.original())
is true.
original()
,
changed(Field)
,
changed(int)
,
changed(String)
boolean changed(Field<?> field)
changed()
,
original(Field)
boolean changed(int fieldIndex)
changed()
,
original(int)
boolean changed(java.lang.String fieldName)
changed()
,
original(String)
void changed(boolean changed)
If the changed
argument is false
, the
original()
values will be reset to the corresponding "current"
values as well
void changed(Field<?> field, boolean changed)
If the changed
argument is false
, the
original(Field)
value will be reset to the corresponding
"current" value as well
changed()
,
changed(Field)
void changed(int fieldIndex, boolean changed)
If the changed
argument is false
, the
original(int)
value will be reset to the corresponding "current"
value as well
changed()
,
changed(int)
void changed(java.lang.String fieldName, boolean changed)
If the changed
argument is false
, the
original(String)
value will be reset to the corresponding
"current" value as well
changed()
,
changed(String)
void reset()
void reset(Field<?> field)
void reset(int fieldIndex)
void reset(java.lang.String fieldName)
java.lang.Object[] intoArray()
The resulting array has the same number of elements as this record has fields. The resulting array contains data as such:
// For arbitrary values of i
record.getValue(i) == record.intoArray()[i]
This is the same as calling into(Object[].class)
fromArray(Object...)
java.util.List<java.lang.Object> intoList()
The resulting list has the same number of elements as this record has fields. The resulting array contains data as such:
// For arbitrary values of i
record.getValue(i) == record.intoList().get(i)
This is the same as calling Arrays.asList(intoArray())
java.util.Map<java.lang.String,java.lang.Object> intoMap()
This is the inverse operation to fromMap(Map)
fromMap(Map)
Record into(Field<?>... fields)
fields
- The fields of the new record@Generated(value="This class was generated using jOOQ-tools") <T1> Record1<T1> into(Field<T1> field1)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2> Record2<T1,T2> into(Field<T1> field1, Field<T2> field2)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3> Record3<T1,T2,T3> into(Field<T1> field1, Field<T2> field2, Field<T3> field3)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4> Record4<T1,T2,T3,T4> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5> Record5<T1,T2,T3,T4,T5> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6> Record6<T1,T2,T3,T4,T5,T6> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7> Record7<T1,T2,T3,T4,T5,T6,T7> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8> Record8<T1,T2,T3,T4,T5,T6,T7,T8> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9> Record9<T1,T2,T3,T4,T5,T6,T7,T8,T9> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> Record10<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> Record11<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> Record12<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> Record13<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> Record14<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> Record15<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> Record16<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> Record17<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> Record18<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> Record19<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20> Record20<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21> Record21<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20, Field<T21> field21)
#into(Record)
@Generated(value="This class was generated using jOOQ-tools") <T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22> Record22<T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22> into(Field<T1> field1, Field<T2> field2, Field<T3> field3, Field<T4> field4, Field<T5> field5, Field<T6> field6, Field<T7> field7, Field<T8> field8, Field<T9> field9, Field<T10> field10, Field<T11> field11, Field<T12> field12, Field<T13> field13, Field<T14> field14, Field<T15> field15, Field<T16> field16, Field<T17> field17, Field<T18> field18, Field<T19> field19, Field<T20> field20, Field<T21> field21, Field<T22> field22)
#into(Record)
<E> E into(java.lang.Class<? extends E> type) throws MappingException
This will map this record onto your custom type using a
RecordMapper
as provided by
Configuration.recordMapperProvider()
. If no custom provider is
specified, the DefaultRecordMapperProvider
is used.
E
- The generic entity type.type
- The entity type.MappingException
- wrapping any reflection exception that might
have occurred while mapping recordsfrom(Object)
,
DefaultRecordMapper
<E> E into(E object) throws MappingException
This is the same as into(Class)
, except that no new object is
instantiated as a result. Instead, you can provide your own custom POJO
instance.
E
- The generic entity type.object
- The receiving bean.MappingException
- wrapping any reflection exception that might
have occurred while mapping recordsjava.lang.NullPointerException
- if object
is null
from(Object)
<R extends Record> R into(Table<R> table)
The mapping algorithm is this:
Record
values by equal field names:
table
argument with
Field.getName()
"MY_field"
(case-sensitive!), a
corresponding field with the same name in this record will be searched.Field.getName()
, then the first one returning true on
Field.equals(Object)
will be returned. (e.g. qualified field
names match)
Table.getRecordType()
must return a class of type
TableRecord
, which must provide a default constructor. Non-public
default constructors are made accessible using
AccessibleObject.setAccessible(boolean)
R
- The generic table record type.table
- The table type.java.sql.ResultSet intoResultSet()
ResultSet
containing the data of this
Record
.
Use this as an adapter for JDBC-compliant code that expects a
ResultSet
to operate on, rather than a jOOQ Result
. The
returned ResultSet
allows for the following behaviour
according to the JDBC specification:
ResultSet.CLOSE_CURSORS_AT_COMMIT
: The cursors (i.e.
Statement
object) are no longer availableResultSet.CONCUR_READ_ONLY
: You cannot update the database
through this ResultSet
, as the underlying Result
object does not hold any open database refences anymoreResultSet.FETCH_FORWARD
: The fetch direction is forward only,
and cannot be changedResultSet.TYPE_SCROLL_INSENSITIVE
: You can use any of the
ResultSet
's scrolling methods, e.g. ResultSet.next()
or ResultSet.previous()
, etc.
You may use DSLContext.fetch(ResultSet)
to unwind this wrapper
again.
This is the same as creating a new Result
with this
Record
only, and then calling Result.intoResultSet()
on that Result
ResultSet
<E> E map(RecordMapper<Record,E> mapper)
mapper
- The mapper callbackvoid from(java.lang.Object source) throws MappingException
The mapping algorithm is this:
source
is an array
Loading of data is delegated to fromArray(Object...)
source
is a Map
Loading of data is delegated to fromMap(Map)
Column
annotations are found on the Class
of the provided source
, only those are used. Matching
candidates are:
Column
getXXX
or isXXX
, if there exists a matching public single-argument
setXXX()
instance method that is annotated with
Column
Column
Column.name()
must match Field.getName()
. All other
annotation attributes are ignored
Column
annotations, or jOOQ can't
find the javax.persistence
API on the classpath, jOOQ will
map members by naming convention:
If Field.getName()
is MY_field
(case-sensitive!),
then this field's value will be fetched from the first of these:
MY_field()
myField()
getMY_field()
getMyField()
MY_field
myField
The resulting record will have its internal "changed" flags set to true
for all values. This means that UpdatableRecord.store()
will
perform an INSERT
statement. If you wish to store the record
using an UPDATE
statement, use
DSLContext.executeUpdate(UpdatableRecord)
instead.
This is the same as calling
record.from(source, record.fields())
source
- The source object to copy data fromMappingException
- wrapping any reflection exception that might
have occurred while mapping recordsinto(Class)
,
from(Object, Field...)
void from(java.lang.Object source, Field<?>... fields) throws MappingException
This is the same as from(Object)
, except that only fields
contained in the fields
argument will be mapped.
source
- The source object to copy data fromfields
- The record's fields to use for mappingMappingException
- wrapping any reflection exception that might
have occurred while mapping recordsinto(Class)
,
from(Object)
void from(java.lang.Object source, java.lang.String... fieldNames) throws MappingException
This is the same as from(Object)
, except that only fields
contained in the fieldNames
argument will be mapped.
source
- The source object to copy data fromfieldNames
- The record's fields names to use for mappingMappingException
- wrapping any reflection exception that might
have occurred while mapping recordsinto(Class)
,
from(Object)
void from(java.lang.Object source, int... fieldIndexes) throws MappingException
This is the same as from(Object)
, except that only fields
contained in the fieldIndexes
argument will be mapped.
source
- The source object to copy data fromfieldIndexes
- The record's fields indexes to use for mappingMappingException
- wrapping any reflection exception that might
have occurred while mapping recordsinto(Class)
,
from(Object)
void fromMap(java.util.Map<java.lang.String,?> map)
The argument map is expected to hold field-name / value pairs where
field-names correspond to actual field names as provided by
field(String)
. Missing fields will be left untouched. Excess
fields will be ignored.
This is the inverse operation to intoMap()
. This is the same as
calling record.fromMap(map, record.fields())
intoMap()
,
fromMap(Map, Field...)
void fromMap(java.util.Map<java.lang.String,?> map, Field<?>... fields)
The argument map is expected to hold field-name / value pairs where
field-names correspond to actual field names as provided by
field(String)
. Missing fields will be left untouched. Excess
fields will be ignored.
This is the same as fromMap(Map)
, except that only fields
contained in the fields
argument will be mapped.
intoMap()
,
fromMap(Map)
void fromMap(java.util.Map<java.lang.String,?> map, java.lang.String... fieldNames)
The argument map is expected to hold field-name / value pairs where
field-names correspond to actual field names as provided by
field(String)
. Missing fields will be left untouched. Excess
fields will be ignored.
This is the same as fromMap(Map)
, except that only fields
contained in the fieldNames
argument will be mapped.
intoMap()
,
fromMap(Map)
void fromMap(java.util.Map<java.lang.String,?> map, int... fieldIndexes)
The argument map is expected to hold field-name / value pairs where
field-names correspond to actual field names as provided by
field(String)
. Missing fields will be left untouched. Excess
fields will be ignored.
This is the same as fromMap(Map)
, except that only fields
contained in the fieldIndexes
argument will be mapped.
intoMap()
,
fromMap(Map)
void fromArray(java.lang.Object... array)
The argument array is expected to hold values for this record's field indexes. Missing values will be left untouched. Excess values will be ignored.
This is the inverse operation to intoArray()
intoArray()
,
fromArray(Object[], Field...)
void fromArray(java.lang.Object[] array, Field<?>... fields)
The argument array is expected to hold values for this record's field indexes. Missing values will be left untouched. Excess values will be ignored.
This is the same as fromArray(Object...)
, except that only
fields contained in the fields
argument will be mapped.
intoArray()
,
fromArray(Object...)
void fromArray(java.lang.Object[] array, java.lang.String... fieldNames)
The argument array is expected to hold values for this record's field indexes. Missing values will be left untouched. Excess values will be ignored.
This is the same as fromArray(Object...)
, except that only
fields contained in the fieldNames
argument will be mapped.
intoArray()
,
fromArray(Object...)
void fromArray(java.lang.Object[] array, int... fieldIndexes)
The argument array is expected to hold values for this record's field indexes. Missing values will be left untouched. Excess values will be ignored.
This is the same as fromArray(Object...)
, except that only
fields contained in the fieldIndexes
argument will be
mapped.
intoArray()
,
fromArray(Object...)
int hashCode()
Record
, based on the underlying row
value expression.
In order to fulfill the general contract of Object.hashCode()
and
Object.equals(Object)
, a Record
's hash code value
depends on all hash code values of this Record
's underlying
column values.
hashCode
in class java.lang.Object
equals(Object)
boolean equals(java.lang.Object other)
Record
with another Record
for
equality.
Two records are considered equal if
i BETWEEN 0 AND degree, r1[i] = r2[i]
Note, that the above rules correspond to the SQL comparison predicate
behaviour as illustrated in the following example:
-- A row value expression comparison predicate
SELECT *
FROM my_table
WHERE (1, 'A') = (1, 'A')
Unlike SQL, jOOQ allows to compare also incompatible records, e.g. records
false
)false
)
It can be said that for all R1, R2, if R1.equal(R2)
, then
R1.compareTo(R2) == 0
equals
in class java.lang.Object
other
- The other recordcompareTo(Record)
,
hashCode()
int compareTo(Record record)
Record
with another Record
according to their natural ordering.
jOOQ Records implement Comparable
to allow for naturally ordering
Records in a "SQL way", i.e. according to the following rules:
Two Records are comparable if and only if they have the same
ROW
type, i.e. if their fieldsRow()
methods return fields of the same type and degree.
Assume the following notations:
X[i]
means X.getValue(i)
X = Y
means X.compareTo(Y) == 0
X < Y
means X.compareTo(Y) < 0
X[i] = Y[i]
means
(X[i] == null && Y[i] == null) || X[i].compareTo(Y[i]) < 0
X[i] < Y[i]
means
Y[i] == null || X[i].compareTo(Y[i]) < 0
. This
corresponds to the SQL NULLS LAST
clause.r1
and r2
,
x = r1.compareTo(r2)
yields:
x = -1
: if
(r1[0] < r2[0])
OR (r1[0] = r2[0] AND r1[1] < r2[1])
OR ...
OR (r1[0] = r2[0] AND ... AND r1[N-1] = r2[N-1] AND r1[N] < r2[N])
x = 0
: if
OR (r1[0] = r2[0] AND ... AND r1[N-1] = r2[N-1] AND r1[N] = r2[N])
x = 1
: if
(r1[0] > r2[0])
OR (r1[0] = r2[0] AND r1[1] > r2[1])
OR ...
OR (r1[0] = r2[0] AND ... AND r1[N-1] = r2[N-1] AND r1[N] > r2[N])
Note, that the above rules correspond to the SQL ordering behaviour as
illustrated in the following examples:
-- A SQL ORDER BY clause, ordering all records by columns in their order
SELECT a, b, c
FROM my_table
ORDER BY 1, 2, 3
-- A row value expression comparison predicate
SELECT *
FROM my_table
WHERE (a, b, c) < (1, 2, 3)
See Row1.lessThan(Row1)
, Row2.lessThan(Row2)
, ...,
Row22.lessThan(Row22)
for more details about row value expression
comparison predicates
Alternative sorting behaviour can be achieved through
Result.sortAsc(java.util.Comparator)
and similar methods.
compareTo
in interface java.lang.Comparable<Record>
java.lang.NullPointerException
- If the argument record is null
java.lang.ClassCastException
- If the argument record is not comparable with
this record according to the above rules.Copyright © 2015. All Rights Reserved.