Entity
A row of EntityClass.table, with the columns it should expose declared as delegated properties.
Subclass one of the typed variants — IntEntity, LongEntity, UuidEntity, CompositeEntity — and give the class a companion object of the matching EntityClass:
class Film(id: EntityID<Int>) : IntEntity(id) {
var title by Films.title
val director by Director referencedOn Films.director
companion object : IntEntityClass<Film>(Films)
}Reading and writing a column property does not suspend and issues no statement: a write is staged in the current transaction's EntityCache and reaches the database on the next flush. The operations that do use the connection — flush, refresh, delete, and the relationship accessors — are suspending.
Parameters
The unique stored identity value for the mapped record.
Inheritors
Properties
This entity's committed column values. Values a transaction has staged but not committed are held by that transaction's EntityCache instead.
The R2dbcDatabase associated with the record mapped to this Entity instance.
The associated EntityClass that manages this Entity instance.
The final column-value mapping for this Entity instance after being flushed and retrieved from the database.
Functions
Sends all cached inserts and updates for this Entity instance to the database.
Reads a property delegated to a CompositeColumn, which stores a single value across several columns:
Reads a property delegated to a transformed column, converting the stored value on the way out:
Writes a property delegated to a CompositeColumn, staging one value per underlying column.
Writes a property delegated to a transformed column, converting the value back to what the column stores.
Declares a many-to-many relationship held by the intermediate table, whose references to this entity's table and to the target's table are inferred from its foreign keys:
Declares a many-to-many relationship, naming sourceColumn and targetColumn explicitly. Use this overload when the intermediate table holds more than one reference to either side, which leaves nothing to infer: