referrersOn
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.CityRegisters 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.AuthorRegisters 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.StudentRegisters 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.