optionalBackReferencedOn

@JvmName(name = "optionalBackReferencedOnOpt")
infix fun <TargetID : Any, Target : Entity<TargetID>, REF : Any> EntityClass<TargetID, Target>.optionalBackReferencedOn(    column: Column<REF?>): OptionalBackReference<TargetID, Target, ID, Entity<ID>, REF>

Registers an optional reference as an immutable field of the parent entity class, which returns a child object of this EntityClass or null if no child references the parent entity.

The reference could have been defined on the child table in 1 of the following ways:

  • By the creation of a column using either optReference() or reference().nullable()

  • By the creation of a non-nullable reference() column where either 0 or 1 row(s) is expected in the relationship

Samples

org.jetbrains.exposed.v1.tests.shared.entities.EntityTests.Studentorg.jetbrains.exposed.v1.tests.shared.entities.EntityTests.StudentBiosorg.jetbrains.exposed.v1.tests.shared.entities.EntityTests.StudentBio

Registers an optional reference as an immutable field of the parent entity class, which returns a child object of this EntityClass or null if no child references the parent entity.

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.Publisherorg.jetbrains.exposed.v1.tests.shared.entities.CompositeIdTableEntityTest.Officesorg.jetbrains.exposed.v1.tests.shared.entities.CompositeIdTableEntityTest.Office