JetBrains / JetBrains/Exposed

Many-To-Many with extra column

Open
#928 5 comments 40 reactions 1 assignee Claimed by @bog-walk View on GitHub
Dominant language
Kotlin
Stars
9.3k
Forks
798
Avg merge
4d 2h
Merged PRs (30d)
26

Description

Hello,

how does one use this framework and the DAO to create a Many-To-Many table with an extra column, which can be accessed from the Entity class referencing the many-to-many table? Take the code from [here](https://github.com/JetBrains/Exposed/wiki/DAO#many-to-many-reference) for example, if I were to add another column to `StarWarsFilmActors`, how do I access it in `StarWarsFilm`? Because there I can only access `Actor`, but not `StarWarsFilmActors`.

I have found a similar issue (#180) which uses a hacky approach with an Entity, but this entity requires the table to have an Id, which is not a wise database-design decision, since the primary key of many-to-many relation tables has to consist of the two referenced tables, and an Id would make it possible to insert all kinds of invalid data into it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.