# referrersOn

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

Registers a reference as an immutable field of the parent entity class, which returns a collection of child objects of this `EntityClass` that all reference the parent.

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

By default, this also stores the loaded entities to a cache.

#### Samples

org.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.Countryorg.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.Citiesorg.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.City

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

Registers a reference as an immutable field of the parent entity class, which returns a collection of child objects of this `EntityClass` that all reference the parent.

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.sql.tests.shared.entities.CompositeIdTableEntityTest.Publisherorg.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Authorsorg.jetbrains.exposed.sql.tests.shared.entities.CompositeIdTableEntityTest.Author

fun <TargetID : Any, Target : Entity<TargetID>, REF : Any> EntityClass<TargetID, Target>.referrersOn(column: Column<REF>, cache: Boolean): Referrers<ID, Entity<ID>, TargetID, Target, REF>

Registers a reference as an immutable field of the parent entity class, which returns a collection of child objects of this `EntityClass` that all reference the parent.

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

Set cache to `true` to also store the loaded entities to a cache.

#### Samples

org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Schoolorg.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Studentsorg.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Student

fun <TargetID : Any, Target : Entity<TargetID>> EntityClass<TargetID, Target>.referrersOn(table: IdTable<*>, cache: Boolean): Referrers<ID, Entity<ID>, TargetID, Target, Any>

Registers a reference as an immutable field of the parent entity class, which returns a collection of child objects of this `EntityClass` that all reference the parent.

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

Set cache to `true` to also store the loaded entities to a cache.