# LongEntity

abstract class LongEntity(id: EntityID<Long>) : Entity<Long>

Base class for an Entity instance identified by an id comprised of a wrapped `Long` value.

## Constructors

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

## Properties

_readValues
Link copied to clipboard
var _readValues: ResultRow?
db
Link copied to clipboard
var db: Database

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

id
Link copied to clipboard
val id: EntityID<Long>
klass
Link copied to clipboard
var klass: EntityClass<Long, Entity<Long>>

The associated EntityClass that manages this Entity instance.

readValues
Link copied to clipboard
val readValues: ResultRow

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

writeValues
Link copied to clipboard
val writeValues: LinkedHashMap<Column<Any?>, Any?>

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

## Functions

delete
Link copied to clipboard
open fun delete()

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

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

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

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

Returns the value assigned to this column mapping.

lookupInReadValues
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.

refresh
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.

setValue
Link copied to clipboard
operator fun <T> Column<T>.setValue(o: Entity<Long>, desc: KProperty<*>, value: T)
operator fun <T> CompositeColumn<T>.setValue(o: Entity<Long>, desc: KProperty<*>, value: T)
operator fun <Unwrapped, Wrapped> EntityFieldWithTransform<Unwrapped, Wrapped>.setValue(o: Entity<Long>, desc: KProperty<*>, value: Wrapped)
operator fun <REF : Any, RID : Any, T : Entity<RID>> OptionalReference<REF, RID, T>.setValue(o: Entity<Long>, desc: KProperty<*>, value: T?)
operator fun <REF : Any, RID : Any, T : Entity<RID>> Reference<REF, RID, T>.setValue(o: Entity<Long>, desc: KProperty<*>, value: T)
storeWrittenValues
Link copied to clipboard
fun storeWrittenValues()

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

via
Link copied to clipboard
infix fun <TID : Any, Target : Entity<TID>> EntityClass<TID, Target>.via(table: Table): InnerTableLink<Long, Entity<Long>, TID, Target>
fun <TID : Any, Target : Entity<TID>> EntityClass<TID, Target>.via(sourceColumn: Column<EntityID<Long>>, targetColumn: Column<EntityID<TID>>): InnerTableLink<Long, Entity<Long>, TID, Target>

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.