Questions tagged [many-to-many]

A type of relationship between entities of types A and B which associates a list of entities of type B to an entity of type A and vice versa. Types A and B may be the same type.

A type of relationship between entities of types A and B which associates a list of entities of type B to an entity of type A and vice versa. Types A and B may be the same type.

8687 questions
2
votes
1 answer

Realm for Android: Many to Many Relationship

I am trying to learn Realm basics by implementing a simple Android project. The idea is that user have several items and several item lists and an item can be added to any of these lists and a list can have many items. Therefore, there is a many to…
Tartar
  • 5,149
  • 16
  • 63
  • 104
2
votes
1 answer

Self Referencing Symmetrical Many to Many Django Model in Admin or View

How do you get the other side of a symmetrical self reference in a M2M django model? Say we are making a parts catalog, and we have lots of Parts and we want to have an Interchange to show which parts can be used in place of another: class…
chris Frisina
  • 19,086
  • 22
  • 87
  • 167
2
votes
1 answer

Symfony Embedded Relation Many2Many - linking unique fields or creating new fields

I'm using an embedded relation to allow the user to edit/add books to a library and in the same form to add/remove n authors who wrote the book within the auto generated admin. Here is my problem: An authors name is unique, so when I enter an author…
hoodie
  • 193
  • 5
2
votes
2 answers

SQL ondelete cascade with join table

I have three tables in database Notes, Tags, NoteTagJoin I'm using many to many database relation with foreign keys which are stored in NoteTagJoin table now I know that you can set for foreign keys onCascade delete and as far as I know if I would…
LeTadas
  • 3,436
  • 9
  • 33
  • 65
2
votes
1 answer

How can i make a calculator in SQL?

So i have this assingment in school, were i am supposed to make a tool for a DPO in a firm. The assignment is as follows: "You are required to develop an app or on-line tool where you can enter the status of the many details that the regulations…
Jake Long
  • 25
  • 6
2
votes
3 answers

how to get only results in many to many relationship in django

I have the following relationships: class Customer(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) class Post(models.Model): customer = models.ForeignKey('common.Customer', mentions =…
Atma
  • 29,141
  • 56
  • 198
  • 299
2
votes
1 answer

Query with dynamic target columns

I am trying to build a view in Postgres that uses 3 tables worth of data. I am not sure if this is possible and have searched around a bit on google but didn't turn up anything conclusive. This is what I am attempting to do: I have a table of item…
NallaN
  • 23
  • 1
  • 4
2
votes
0 answers

NHibernate many-to-many behaviour on db

We have Bar and Foo classes, they have a simple many-to-many relationship: public partial class Bar { public virtual Guid BarId { get; set; } = Guid.Empty; public virtual IList ManyBarsInManyFoos { get; protected set; } = new…
2
votes
2 answers

Entity Framework Many To Many Relationships initializing ICollection

so as an example lets say we have the following situation: I have a class called StandardEngineeredModel which has properties like ModelNumber, VoltageInput, VoltageOutput etc. I also have a class called Fuse that has properties like Designator,…
2
votes
2 answers

CanCan ability on association

My question is about defining cancancan ability in this following context. I have a common model with many to many relationship between User and Company entities class User < ApplicationRecord has_many :company_users, dependent: :destroy …
P.Bra
  • 264
  • 1
  • 12
2
votes
1 answer

Hibernate @ManyToMany not uses joinTable and produces Cartesian instead of inner join

Colleagues, could you please to advise me with Hibernate issues when the relationship @ManyToMany. Project Entity: @Entity @Table(name = "PROJECT") @NamedQueries( { @NamedQuery(name = "Projects.employeesByExternal", query =…
vzateychuk
  • 301
  • 1
  • 3
  • 12
2
votes
1 answer

how to correctly assign the through attribute in django?

I was just looking the documentation to be able to change the intermediate table but when I implement it, I get into trouble: https://docs.djangoproject.com/en/2.0/topics/db/models/#extra-fields-on-many-to-many-relationships The problem as such is…
2
votes
1 answer

SQLite3 how to create an insert statement for many-to-many relationship?

Let's say you have three basic tables that implement a many-to-many relationship between tasks and categories: CREATE TABLE task( id INTEGER AUTOINCREMENT PRIMARY KEY NOT NULL, name INTEGER NOT NULL, description INTEGER NOT…
Samuel Cole
  • 521
  • 6
  • 24
2
votes
2 answers

Symfony Doctrine - In a many to many relation why is the patch working in one direction but not the other

I'm on a project where I have a many to many relationship between team and agent. Because my teams can have multiple agents and my agents can have multiple teams. I'm in a situation where I'm doing a patch so I can add multiple agents to a team…
Frabot
  • 41
  • 7
2
votes
2 answers

Relationship table data overwritten in many-to-many hibernate

I have two entity classes Order and Product with many-to-many relationship (several orders may have the same product as far as stock is not empty and an order may contain multiple products)as follows: @Entity @Table(name = "Order_") public class…
Lok
  • 131
  • 8
1 2 3
99
100