Any Record can be updatable, if
TableRecord
The "main unique key" is used by jOOQ to perform the various operations that
can be performed on an UpdatableRecord:
delete() : Deleting the recordrefresh() : Refreshing the records attributes (or loading it for
the first time)store() : Storing the record to the database. This executes
either an INSERT or an UPDATE statementmerge() : Merging a record to the database. This executes an
INSERT … ON DUPLICATE KEY UPDATE statement.
UpdatableRecords are Attachable, which means that they
hold an underlying Configuration that they can be detached from. They
can also be instantiated without any underlying Configuration, in
case of which they have to be attached first, in order to be refreshed,
stored, or deleted.
| Modifier and Type | Method and Description |
|---|---|
| public <O extends TableRecord | children(ForeignKey<O, R> key)
Get a table expression representing the children of this record, given a foreign key. |
| public R | |
| public int | Returns: 1 if the record was deleted from the database.
0 if deletion was not necessary.Deletes this record from the database, based on the value of the primary key or main unique key. |
| public <O extends TableRecord | |
| public <O extends TableRecord | |
| public int | Returns: 1 if the record was stored to the database. 0
if storing was not necessary and
Settings#isInsertUnchangedRecords() is set to false.Redeclares org. INSERT
statement.
|
| public int | Returns: 1 if the record was stored to the database. 0
if storing was not necessary.Redeclares org.
Deprecated
as a consequence of
Store parts of this record to the database using an Field being deprecated.
INSERT
statement.
|
| public int | Returns: 1 if the record was stored to the database. 0
if storing was not necessary.Redeclares org. INSERT
statement.
|
| public @NotNull Record | |
| public int | Returns: 1 if the record was merged to the database. 0
if merging was not necessary.Store this record back to the database using a |
| public int | |
| public int | Returns: 1 if the record was merged to the database. 0
if merging was not necessary.Store parts of this record to the database using a |
| public void | |
| public void | |
| public void | |
| public int | Returns: 1 if the record was stored to the database. 0
if storing was not necessary.Store this record back to the database. |
| public int | |
| public int | Returns: 1 if the record was stored to the database. 0
if storing was not necessary.Store parts of this record to the database. |
| public int | Returns: 1 if the record was stored to the database. 0
if storing was not necessary.Store this record back to the database using an |
| public int | |
| public int | Returns: 1 if the record was stored to the database. 0
if storing was not necessary.Store parts of this record to the database using an |
| children | back to summary |
|---|---|
| public <O extends TableRecord Get a table expression representing the children of this record, given a foreign key. | |
| copy | back to summary |
|---|---|
| public R copy() Duplicate this record (in memory) and reset all fields from the primary
key or main unique key, such that a subsequent call to
| |
| delete | back to summary |
|---|---|
| public int delete() throws DataAccessException, DataChangedException Deletes this record from the database, based on the value of the primary key or main unique key.
Optimistic locking
If a
Statement examplesThe executed statement is
This is in fact the same as calling
| |
| fetchChild | back to summary |
|---|---|
| public <O extends TableRecord Fetch a child record of this record, given a foreign key.
This returns a child record referencing this record through a given
foreign key, as if fetching from
A separate roundtrip is created by this operation. It is
often much better to include parent records using ordinary
| |
| fetchChildren | back to summary |
|---|---|
| public <O extends TableRecord Fetch child records of this record, given a foreign key.
This returns child records referencing this record through a given
foreign key, as if fetching from
A separate roundtrip is created by this operation. It is
often much better to include parent records using ordinary
| |
| insert | back to summary |
|---|---|
| public int insert() throws DataAccessException Redeclares org. Store this record back to the database using an
This is the same as
If you want to enforce re-insertion this record's values, regardless if
the values in this record were changed, you can explicitly set the
changed flags for all values with
This is the same as calling
| |
| insert | back to summary |
|---|---|
| public int insert(Field<?>... fields) throws DataAccessException Redeclares org. Deprecated as a consequence of Store parts of this record to the database using an
| |
| insert | back to summary |
|---|---|
| public int insert(Collection<? extends Field<?>> fields) throws DataAccessException Redeclares org. Store parts of this record to the database using an
| |
| key | back to summary |
|---|---|
| public @NotNull Record key() A Record copy holding values for the
The returned record consists exactly of those fields as returned by the
table's primary key:
Generated subtypes may covariantly override this method to add more
record type information. For instance, they may return
| |
| merge | back to summary |
|---|---|
| public int merge() throws DataAccessException Store this record back to the database using a
Unlike
When optimistic locking is active for this record, then this operation
will execute
If you want to enforce statement execution, regardless if the values in
this record were changed, you can explicitly set the changed flags for
all values with
This is the same as calling
| |
| merge | back to summary |
|---|---|
| public int merge(Field<?>... fields) throws DataAccessException
Deprecated as a consequence of Store parts of this record to the database using a | |
| merge | back to summary |
|---|---|
| public int merge(Collection<? extends Field<?>> fields) throws DataAccessException Store parts of this record to the database using a | |
| refresh | back to summary |
|---|---|
| public void refresh() throws DataAccessException Refresh this record from the database. A successful refresh results in the following:
Refreshing can trigger any of the following actions:
This is the same as calling
| |
| refresh | back to summary |
|---|---|
| public void refresh(Field<?>... fields) throws DataAccessException, NoDataFoundException
Deprecated as a consequence of Refresh parts of this record from the database. A successful refresh results in the following:
Refreshing can trigger any of the following actions:
This is the same as calling
| |
| refresh | back to summary |
|---|---|
| public void refresh(Collection<? extends Field<?>> fields) throws DataAccessException, NoDataFoundException Refresh parts of this record from the database. A successful refresh results in the following:
Refreshing can trigger any of the following actions:
This is the same as calling
| |
| store | back to summary |
|---|---|
| public int store() throws DataAccessException, DataChangedException Store this record back to the database.
Depending on the state of the primary key's value, an
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
Automatic value generation
Use
Optimistic locking
If an
Statement examplesPossible statements are
Statement execution enforcement
If you want to control statement re-execution, regardless if the values
in this record were changed, you can explicitly set the changed flags for
all values with
This is the same as calling
| |
| store | back to summary |
|---|---|
| public int store(Field<?>... fields) throws DataAccessException, DataChangedException
Deprecated as a consequence of Store parts of this record to the database.
| |
| store | back to summary |
|---|---|
| public int store(Collection<? extends Field<?>> fields) throws DataAccessException, DataChangedException Store parts of this record to the database.
| |
| update | back to summary |
|---|---|
| public int update() throws DataAccessException, DataChangedException Store this record back to the database using an
This is the same as
If you want to enforce statement execution, regardless if the values in
this record were changed, you can explicitly set the changed flags for
all values with
This is the same as calling
| |
| update | back to summary |
|---|---|
| public int update(Field<?>... fields) throws DataAccessException, DataChangedException
Deprecated as a consequence of Store parts of this record to the database using an
| |
| update | back to summary |
|---|---|
| public int update(Collection<? extends Field<?>> fields) throws DataAccessException, DataChangedException Store parts of this record to the database using an
| |