Entity

open class Entity<ID : Comparable<ID>>(val id: EntityID<ID>)

Class representing a mapping to values stored in a table record in a database.

Parameters

id

The unique stored identity value for the mapped record.

Inheritors

Constructors

Link copied to clipboard
constructor(id: EntityID<ID>)

Properties

Link copied to clipboard
Link copied to clipboard

The Database associated with the record mapped to this Entity instance.

Link copied to clipboard
val id: EntityID<ID>
Link copied to clipboard

The associated EntityClass that manages this Entity instance.

Link copied to clipboard

The final column-value mapping for this Entity instance after being flushed and retrieved from the database.

Link copied to clipboard

The initial column-value mapping for this Entity instance before being flushed and inserted into the database.

Functions

Link copied to clipboard
open fun delete()

Deletes this Entity instance, both from the cache and from the database.

Link copied to clipboard
open fun flush(batch: EntityBatchUpdate? = null): Boolean

Sends all cached inserts and updates for this Entity instance to the database.

Link copied to clipboard
operator fun <REF : Comparable<REF>, RID : Comparable<RID>, T : Entity<RID>> OptionalReference<REF, RID, T>.getValue(o: Entity<ID>, desc: KProperty<*>): T?
operator fun <REF : Comparable<REF>, RID : Comparable<RID>, T : Entity<RID>> Reference<REF, RID, T>.getValue(o: Entity<ID>, desc: KProperty<*>): T
operator fun <T> Column<T>.getValue(o: Entity<ID>, desc: KProperty<*>): T
operator fun <T> CompositeColumn<T>.getValue(o: Entity<ID>, desc: KProperty<*>): T
Link copied to clipboard
fun <T> Column<T>.lookup(): T

Returns the value assigned to this column mapping.

Link copied to clipboard
fun <T, R : Any> Column<T>.lookupInReadValues(found: (T?) -> R?, notFound: () -> R?): R?

Checks if this column has been assigned a value retrieved from the database, then calls the found block with this value as its argument, and returns its result.

Link copied to clipboard
open fun refresh(flush: Boolean = false)

Updates the fields of this Entity instance with values retrieved from the database. Override this function to refresh some additional state, if any.

Link copied to clipboard
operator fun <REF : Comparable<REF>, RID : Comparable<RID>, T : Entity<RID>> OptionalReference<REF, RID, T>.setValue(o: Entity<ID>, desc: KProperty<*>, value: T?)
operator fun <REF : Comparable<REF>, RID : Comparable<RID>, T : Entity<RID>> Reference<REF, RID, T>.setValue(o: Entity<ID>, desc: KProperty<*>, value: T)
operator fun <T> Column<T>.setValue(o: Entity<ID>, desc: KProperty<*>, value: T)
operator fun <T> CompositeColumn<T>.setValue(o: Entity<ID>, desc: KProperty<*>, value: T)
Link copied to clipboard

Transfers initial column-value mappings from writeValues to readValues and clears the former once complete.

Link copied to clipboard

Registers a reference as a field of the child entity class, which returns a parent object of this EntityClass, for use in many-to-many relations.