Back to Exposed

CompositeEntity

docs/api/exposed-dao/org.jetbrains.exposed.v1.dao/-composite-entity/index.html

1.2.016.7 KB
Original Source

CompositeEntity

abstract class CompositeEntity(id: EntityID<CompositeID>) : Entity<CompositeID>

Base class for an Entity instance identified by an id comprised of multiple wrapped values.

Members

Constructors

CompositeEntity

Link copied to clipboard

constructor(id: EntityID<CompositeID>)

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<CompositeID>

klass

Link copied to clipboard

var klass: EntityClass<CompositeID, Entity<CompositeID>>

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<CompositeID>, desc: KProperty<*>): T

operator fun <T> CompositeColumn<T>.getValue(o: Entity<CompositeID>, desc: KProperty<*>): T

operator fun <Unwrapped, Wrapped> EntityFieldWithTransform<Unwrapped, Wrapped>.getValue(o: Entity<CompositeID>, desc: KProperty<*>): Wrapped

operator fun <REF : Any, RID : Any, T : Entity<RID>> OptionalReference<REF, RID, T>.getValue(o: Entity<CompositeID>, desc: KProperty<*>): T?

operator fun <REF : Any, RID : Any, T : Entity<RID>> Reference<REF, RID, T>.getValue(o: Entity<CompositeID>, 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<CompositeID>, desc: KProperty<*>, value: T)

operator fun <T> CompositeColumn<T>.setValue(o: Entity<CompositeID>, desc: KProperty<*>, value: T)

operator fun <Unwrapped, Wrapped> EntityFieldWithTransform<Unwrapped, Wrapped>.setValue(o: Entity<CompositeID>, desc: KProperty<*>, value: Wrapped)

operator fun <REF : Any, RID : Any, T : Entity<RID>> OptionalReference<REF, RID, T>.setValue(o: Entity<CompositeID>, desc: KProperty<*>, value: T?)

operator fun <REF : Any, RID : Any, T : Entity<RID>> Reference<REF, RID, T>.setValue(o: Entity<CompositeID>, 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<CompositeID, Entity<CompositeID>, TID, Target>

fun <TID : Any, Target : Entity<TID>> EntityClass<TID, Target>.via(sourceColumn: Column<EntityID<CompositeID>>, targetColumn: Column<EntityID<TID>>): InnerTableLink<CompositeID, Entity<CompositeID>, 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.

Generated by Dokka © 2026 Copyright