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)
          Deletes this record from the database, based on the value of the provided keys.
 Table<R> getTable()
          The table from which this record was read
 void refreshUsing(TableField<R,?>... keys)
          Refresh this record from the database, based on the value of the provided keys.
 int storeUsing(TableField<R,?>... keys)
          Store this record back to the database.
 
Methods inherited from interface org.jooq.Record
from, 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, intoArray, setValue, setValue
 
Methods inherited from interface org.jooq.FieldProvider
getField, getField, getField, getFields, getIndex
 
Methods inherited from interface org.jooq.Store
getValue, getValue, getValue, getValue, 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, size
 
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

int storeUsing(TableField<R,?>... keys)
               throws DataAccessException
Store this record back to the database.

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

In either statement, 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.

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

deleteUsing

int deleteUsing(TableField<R,?>... keys)
                throws DataAccessException
Deletes this record from the database, based on the value of the provided keys.

The executed statement is

 DELETE FROM [table]
 WHERE [key fields = key 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

refreshUsing

void refreshUsing(TableField<R,?>... keys)
                  throws DataAccessException
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.


Copyright © 2012. All Rights Reserved.