Back to Exposed

backReferencedOn

docs/api/exposed-dao/org.jetbrains.exposed.v1.dao/-entity-class/back-referenced-on.html

1.2.03.5 KB
Original Source

backReferencedOn

infix fun <TargetID : Any, Target : Entity<TargetID>, REF : Any> EntityClass<TargetID, Target>.backReferencedOn(column: Column<REF>): ReadOnlyProperty<Entity<ID>, Target>

@JvmName(name = "backReferencedOnOpt")

infix fun <TargetID : Any, Target : Entity<TargetID>, REF : Any> EntityClass<TargetID, Target>.backReferencedOn(column: Column<REF?>): ReadOnlyProperty<Entity<ID>, Target>

Registers a reference as an immutable field of the parent entity class, which returns a child object of this EntityClass.

The reference should have been defined by the creation of a column using reference() on the child table.

Samples

org.jetbrains.exposed.v1.tests.shared.entities.EntityTestsData.YEntityorg.jetbrains.exposed.v1.tests.shared.entities.EntityTestsData.XTableorg.jetbrains.exposed.v1.tests.shared.entities.EntityTestsData.BEntity


infix fun <TargetID : Any, Target : Entity<TargetID>> EntityClass<TargetID, Target>.backReferencedOn(table: IdTable<*>): ReadOnlyProperty<Entity<ID>, Target>

Registers a reference as an immutable field of the parent entity class, which returns a child object of this EntityClass.

The reference should have been defined by the creation of a foreign key constraint on the child table, by using foreignKey().

Samples

org.jetbrains.exposed.v1.tests.shared.entities.CompositeIdTableEntityTest.Bookorg.jetbrains.exposed.v1.tests.shared.entities.CompositeIdTableEntityTest.Reviewsorg.jetbrains.exposed.v1.tests.shared.entities.CompositeIdTableEntityTest.Review

Generated by Dokka © 2026 Copyright