optionalReferrersOn
Registers an optional 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 either optReference()
or reference().nullable()` on the child table.
By default, this also stores the loaded entities to a cache.
Samples
org.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Categoryorg.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Postsorg.jetbrains.exposed.sql.tests.shared.entities.EntityTests.PostRegisters an optional 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()
.
By default, this also stores the loaded entities to a cache.
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 an optional 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 either optReference()
or reference().nullable()
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.Studentorg.jetbrains.exposed.sql.tests.shared.entities.EntityTests.Detentionsorg.jetbrains.exposed.sql.tests.shared.entities.EntityTests.DetentionRegisters an optional 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.