# via

infix fun <TID : Any, Target : Entity<TID>> EntityClass<TID, Target>.via(table: Table): InnerTableLink<ID, Entity<ID>, TID, Target>

Registers a reference as a field of the child entity class, which returns a parent object of this EntityClass, for use in many-to-many relations.

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

#### Parameters

table

The intermediate table containing reference columns to both child and parent objects.

#### Samples

org.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.Userorg.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.Cityorg.jetbrains.exposed.sql.tests.shared.entities.EntityHookTestData.UsersToCities

fun <TID : Any, Target : Entity<TID>> EntityClass<TID, Target>.via(sourceColumn: Column<EntityID<ID>>, targetColumn: Column<EntityID<TID>>): InnerTableLink<ID, Entity<ID>, TID, Target>

Registers a reference as a field of the child entity class, which returns a parent object of this EntityClass, for use in many-to-many relations.

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

#### Parameters

sourceColumn

The intermediate table's reference column for the child entity class.

targetColumn

The intermediate table's reference column for the parent entity class.

#### Samples

org.jetbrains.exposed.sql.tests.shared.entities.ViaTests.NodesTableorg.jetbrains.exposed.sql.tests.shared.entities.ViaTests.Nodeorg.jetbrains.exposed.sql.tests.shared.entities.ViaTests.NodeToNodes