InnerTableLink

class InnerTableLink<SID : Any, Source : Entity<SID>, ID : Any, Target : Entity<ID>>(val table: Table, sourceTable: IdTable<SID>, val target: EntityClass<ID, Target>, _sourceColumn: Column<EntityID<SID>>? = null, _targetColumn: Column<EntityID<ID>>? = null) : ReadWriteProperty<Source, SizedIterable<Target>>

What a many-to-many relationship declared with via gives back: the entities linked to this one through an intermediate table.

class Film(id: EntityID<Int>) : IntEntity(id) {
var actors by Actor via FilmActors

companion object : IntEntityClass<Film>(Films)
}

film.actors = SizedCollection(actor1, actor2) // replaces the rows in FilmActors
val cast = film.actors.toList()

Unlike the other relationships, this property is a var: assigning a collection rewrites the links.

Parameters

table

The intermediate table containing reference columns to both child and parent entities.

sourceTable

The IdTable associated with the source child entity.

target

The EntityClass for the target parent entity.

_sourceColumn

The intermediate table's reference column for the child entity class. If left null, this will be inferred from the provided intermediate table columns.

_targetColumn

The intermediate table's reference column for the parent entity class. If left null, this will be inferred from the provided intermediate table columns.

Constructors

Link copied to clipboard
constructor(table: Table, sourceTable: IdTable<SID>, target: EntityClass<ID, Target>, _sourceColumn: Column<EntityID<SID>>? = null, _targetColumn: Column<EntityID<ID>>? = null)

Properties

Link copied to clipboard

The reference identity column for the child entity class.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The reference identity column for the parent entity class.

Functions

Link copied to clipboard
open operator override fun getValue(o: Source, unused: KProperty<*>): SizedIterable<Target>
Link copied to clipboard

Modifies this reference to sort entities according to the specified order.

Modifies this reference to sort entities based on multiple columns as specified in order.

infix fun orderBy(expression: Expression<*>): InnerTableLink<SID, Source, ID, Target>

Modifies this reference to sort entities by a column specified in expression using ascending order.

Link copied to clipboard
open operator override fun setValue(o: Source, unused: KProperty<*>, value: SizedIterable<Target>)