question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Additional properties on JoinTable

See original GitHub issue

Issue type:

[*] question [ ] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [*] mysql / mariadb [ ] oracle [ ] postgres [ ] sqlite [ ] sqljs [ ] react-native

TypeORM version:

[*] latest [ ] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Would it be possible to add additional columns on JoinTable to keep relation specific data.

export class ProductGroup {

    @PrimaryGeneratedColumn()
    id: number;

    @ManyToMany(() => ProductGroup)
    @JoinTable({
        name: "accessory",
        joinColumn: {
            name: "product",
            referencedColumnName: "id"
        },
        inverseJoinColumn: {
            name: "accessory",
            referencedColumnName: "id"
        },
    })
    accessories: ProductGroup[];

}

Here each product has many related products, and they need to be sorted according to specified order, for which I need to save additional field order on the accessory table.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

10reactions
SharmaTusharcommented, Jun 6, 2018

Thanks.

Forget about JoinTable.

This is what I needed to hear.

1reaction
pleerockcommented, Jun 6, 2018

I provided answer to your question. Now you need to try. You need to create two entities and make a one-to-many-many-to-one relations between them. Forget about JoinTable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding additional Property to hibernate JoinTable
I am joining the two entities using @JoinTable, however, I would like to add a "status" column to the join table to tell...
Read more >
Persist extra attributes for relationships with JPA & Hibernate
Even join tables for many-to-many relationships are hidden behind a @JoinTable annotation, and you don't need to model the additional table as an...
Read more >
Join table extra properties | Objection.js - GitHub Pages
In objection, these properties can be defined as extra properties of many-to-many relationship. Let's consider a schema like this: exports.up = knex =>...
Read more >
Code First Entity Framework: Additional properties on many to ...
One of the features of Code First is the automatic creation of join tables for many to many relationships, Entity Framework will manage ......
Read more >
JoinTable (Java(TM) EE 7 Specification APIs)
Annotation Type JoinTable ... Specifies the mapping of associations. It is applied to the owning side of an association. A join table is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found