org.jooq
Interface TableRecord<R extends TableRecord<R>>

Type Parameters:
R - The record type
All Superinterfaces:
Adapter, Attachable, FieldProvider, Record, Serializable, Store<Object>
All Known Subinterfaces:
UpdatableRecord<R>
All Known Implementing Classes:
CustomRecord, TableRecordImpl, UpdatableRecordImpl

public interface TableRecord<R extends TableRecord<R>>
extends Record

A record originating from a single table

Author:
Lukas Eder

Method Summary
 int deleteUsing(TableField<R,?>... keys)
          Deprecated. - 2.5.0 [#1736] - These methods will be made part of jOOQ's internal API soon. Do not reuse these methods.
 Table<R> getTable()
          The table from which this record was read
 R original()
          Get this record containing the original values as fetched from the database.
 void refreshUsing(TableField<R,?>... keys)
          Deprecated. - 2.5.0 [#1736] - These methods will be made part of jOOQ's internal API soon. Do not reuse these methods.
 int storeUsing(TableField<R,?>... keys)
          Deprecated. - 2.5.0 [#1736] - These methods will be made part of jOOQ's internal API soon. Do not reuse these methods.
 
Methods inherited from interface org.jooq.Record
changed, from, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValue, getValueAsArray, getValueAsArray, getValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigInteger, getValueAsBigInteger, getValueAsBigInteger, getValueAsBigInteger, getValueAsBoolean, getValueAsBoolean, getValueAsBoolean, getValueAsBoolean, getValueAsByte, getValueAsByte, getValueAsByte, getValueAsByte, getValueAsDate, getValueAsDate, getValueAsDate, getValueAsDate, getValueAsDouble, getValueAsDouble, getValueAsDouble, getValueAsDouble, getValueAsFloat, getValueAsFloat, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong, getValueAsLong, getValueAsLong, getValueAsShort, getValueAsShort, getValueAsShort, getValueAsShort, getValueAsString, getValueAsString, getValueAsString, getValueAsString, getValueAsTime, getValueAsTime, getValueAsTime, getValueAsTime, getValueAsTimestamp, getValueAsTimestamp, getValueAsTimestamp, getValueAsTimestamp, into, into, into, intoArray, intoMap, map, setValue, setValue, size
 
Methods inherited from interface org.jooq.FieldProvider
getField, getField, getField, getFields, getIndex
 
Methods inherited from interface org.jooq.Store
getValueAsBigDecimal, getValueAsBigDecimal, getValueAsBigInteger, getValueAsBigInteger, getValueAsBoolean, getValueAsBoolean, getValueAsByte, getValueAsByte, getValueAsDate, getValueAsDate, getValueAsDouble, getValueAsDouble, getValueAsFloat, getValueAsFloat, getValueAsInteger, getValueAsInteger, getValueAsLong, getValueAsLong, getValueAsShort, getValueAsShort, getValueAsString, getValueAsString, getValueAsTime, getValueAsTime, getValueAsTimestamp, getValueAsTimestamp
 
Methods inherited from interface org.jooq.Attachable
attach
 
Methods inherited from interface org.jooq.Adapter
internalAPI
 

Method Detail

getTable

Table<R> getTable()
The table from which this record was read


storeUsing

@Deprecated
int storeUsing(TableField<R,?>... keys)
               throws DataAccessException,
                      DataChangedException
Deprecated. - 2.5.0 [#1736] - These methods will be made part of jOOQ's internal API soon. Do not reuse these methods.

Store this record back to the database.

Depending on the state of the provided keys' value, an INSERT or an UPDATE statement is executed.

Statement type

In either statement type, only those fields are inserted/updated, which had been explicitly set by client code, in order to allow for DEFAULT values to be applied by the underlying RDBMS. If no fields were modified, neither an UPDATE nor an INSERT will be executed.

Automatic value generation

Optimistic locking

If an UPDATE statement is executed and Settings.isExecuteWithOptimisticLocking() is set to true, then this record will first be compared with the latest state in the database. There are two modes of operation for optimistic locking:

Statement examples

Possible statements are

Parameters:
keys - The key fields used for deciding whether to execute an INSERT or UPDATE statement. If an UPDATE statement is executed, they are also the key fields for the UPDATE statement's WHERE clause.
Returns:
The number of stored records.
Throws:
DataAccessException - if something went wrong executing the query
DataChangedException - If optimistic locking is enabled and the record has already been changed/deleted in the database

deleteUsing

@Deprecated
int deleteUsing(TableField<R,?>... keys)
                throws DataAccessException,
                       DataChangedException
Deprecated. - 2.5.0 [#1736] - These methods will be made part of jOOQ's internal API soon. Do not reuse these methods.

Deletes this record from the database, based on the value of the provided keys.

Optimistic locking

If a DELETE statement is executed and Settings.isExecuteWithOptimisticLocking() is set to true, then this record will first be compared with the latest state in the database. There are two modes of operation for optimistic locking:

Statement examples

The executed statement is

 DELETE FROM [table]
 WHERE [key fields = key values]
 AND [version/timestamp fields = version/timestamp values]

Parameters:
keys - The key fields for the DELETE statement's WHERE clause.
Returns:
The number of deleted records.
Throws:
DataAccessException - if something went wrong executing the query
DataChangedException - If optimistic locking is enabled and the record has already been changed/deleted in the database

refreshUsing

@Deprecated
void refreshUsing(TableField<R,?>... keys)
                  throws DataAccessException
Deprecated. - 2.5.0 [#1736] - These methods will be made part of jOOQ's internal API soon. Do not reuse these methods.

Refresh this record from the database, based on the value of the provided keys.

The executed statement is

 SELECT * FROM [table]
 WHERE [key fields = key values]

Parameters:
keys - The key fields for the SELECT statement's WHERE clause.
Throws:
DataAccessException - This exception is thrown if
  • something went wrong executing the query
  • the record does not exist anymore in the database
  • the provided keys return several records.

original

R original()
Get this record containing the original values as fetched from the database.

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.

Specified by:
original in interface Record


Copyright © 2012. All Rights Reserved.