Newest 'many-to-many' Questions - Stack Overflow

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.

0
votes
0answers
19 views

Restrict EntityType and add it multiple

I'm working at an advent calendar with a prize game. Every door of the calender can have several prizes. Every prize can have several questions. Every question can have several answers (wrong and ...
0
votes
1answer
20 views

Hibernate Many To Many with condition

I have two entities that connected to each other with Many To Many relations. public class City{ Integer id; String name; List<Person> people; } public class Person{ Integer id;...
1
vote
0answers
20 views

Override association many-to-many with a mapped superclass in Doctrine

I want to make a many-to-many association between a mapped superclass CommonResource and an entity Author. We are using the syntaxis provided by the doctrine manual on this topic: association override ...
0
votes
0answers
10 views

Dismissing a partially filled out form in ModelFormSet with a ManytoMany field

I have a Modelformset that contains a manytomany field. The M2M field, is rendered as a ModelMultipleChoiceField. The whole thing runs fine when all forms are filled out. In short, the only user ...
1
vote
0answers
22 views

How to create viewmodel ,controller & view to join many to many table in asp.net mvc Entity framework

I want to join & display "ProductId,Quantity,UnitPrice,Discount & Total" columns from tblOrder ,tblCustomer ,tblProduct tables where OrderNo= givenId . OrderNo is given through a textbox....
0
votes
0answers
13 views

Is there a way to create many-to-many relationships with every extract of Data in Pandas?

After extracting Data for my ETL process, I am getting a JSON file where some fields are lists. In my example the Data is about support tickets and the field which is a list, is cc_emails. What I want ...
1
vote
0answers
30 views

trying to access a ManyToManyField from db query but returning None

Im tring to access a ManyToManyFireld property after model query but get back None. This is what the model looks like. class Role(models.Model): ROLES = Choices('user', 'staff', 'admin') ...
0
votes
0answers
16 views

Django ManyToMany not stored

I wrote the following code: related_fixture = Fixture.objects.create(home=home, away=away, total_goals=total_goals, total_away_goals=total_goals_away, total_home_goals=total_goals_home, ...
0
votes
1answer
21 views

How to multiply NumberDecimal values in mongodb

I have the following structure: { "_id": "5d0118f0f57a282f89bc5f71", "product": { "_id": "5cfed37375a13067dd01ddb7", "name": "My product", ...
-2
votes
1answer
23 views

MySQL and PHP procedural many to many query [duplicate]

I have a simple many to many relationship with news and category.When I try to make a query to select all posts from a category, something went wrong and nothing appears. Query: DB Schema: Loop ...
1
vote
0answers
38 views

How to fix: Relationships between two pivot tables

Im trying to make a relationship in laravel between 3 tables. First we have the "decks" table, which contains the information of every deck with id of the owner. Then we have the "cards" table, which ...
0
votes
4answers
58 views

HQL select query on @ManyToMany mapped entity produces invalid SQL syntax

There are a bunch of questions here about queries on HQL many-to-many mapped tables but I have looked quite a bit and have not seen this one. I have two tables in a many-to-many relationship with the ...
0
votes
0answers
25 views

How do I build many-to-many relationships on a class that has one reference list of the same type, with a linking object?

I'm developing a note tracking application and need to have references between some notes. I'm using a Note class and an intermediary RelatedNote class to hold each one-to-one reference: public class ...
0
votes
0answers
12 views

A form for editing the objects (tags) in a many-to-many relationship? (Django)

I have a model Post and a model Tag. Each post can have multiple related tags. class Post(models.Model): title = models.CharField() url = models.CharField() class Tag(models.Model): ...
2
votes
0answers
58 views

How to optimize performance in many to many relation?

I have 3 tables (MySQL): Students Groups StudentsToGroups All tables presented like models and have their own classes. So, I want to show in view list of students with their group's names. Very ...
1
vote
1answer
23 views

Understanding many to many relationships: How can I choose the instances that belong to my Many to Many relationship field in django?ny

I have two models that I want to relate with a many to many relationship. BuildingGroup and Building My idea is that for example Building Group1 contains some Buildings and BuildingGroup2 contains ...
0
votes
3answers
34 views

How to overwrite get_queryset method to only display the objects that are contained within a many-to-many field in django?

I have an API that has two models. Buildings and BuildingGroup. Every building is within a building group. I want to overwrite the get_queryset method to display only buildings that are within a ...
1
vote
2answers
51 views

With a many-to-many relationship, search by the many for the one

I have a many-to-many relationship between releases and artifacts, where a given release is associated with multiple artifacts, and a given artifact is associated with multiple releases. I understand ...
0
votes
1answer
28 views

Overriding save() on many-to-many fields with a 'through' field

With the code below, when performing set_instance.items.add() how can I have SetMeta.order to default to len(set.items.all()) I've tried over riding save() on SetMeta but save doesn't get called when ...
0
votes
1answer
26 views

How to override how many-to-many saves on 'through' field in Django?

Summary I want to auto-increment an order field on Item defined with m2m fields within a Set (bad name I know) so I can easily change their order. The many-to-many field is defined with a through ...
0
votes
1answer
29 views

JPA: 'CascadeType.REMOVE' or 'orphanRemoval = true', which use in a n:n relation that generate new table/class with EmbeddeId class?

I am developing an REST API to a pizzeria store. And here i'm trying to delete a Flavor and all data related to it. Further explained below: Classes: Flavor have at least one Filling, each one ...
0
votes
0answers
39 views

SQLAlchemy many-to-many relationship with extra join condition [duplicate]

I have a many-to-many relationship between Parent and Child. In my views.py I do: parents = s.query(Parent) In my (Jinja2) template I do something like: for parent in parents: print("parent {...
0
votes
0answers
24 views

Django - Add record to Many-to-many field (SelectMultiple widget) in form view

I'm trying to add records to manytomany field in form view and i don't know how to do it. I want something like the "plus" button in django's admin default site, to add new options in the selection ...
0
votes
0answers
13 views

How to Select from Bagged Table in Nhibernate?

I've been trying to do some stuff with the table that is not modeled but is there with the BAG feature of NHibernate. My Exam Model: public class Exam { (.... other stuff here ....) ...
0
votes
1answer
22 views

Unable to set many to many relationship in overwritten save method

I am trying to create a system where I set up an issue and it automatically creates custom fields that a user will have defined stored in another model. I set my current model up with a many to many ...
0
votes
0answers
28 views

Room SELECT for “many to many”

Let's assume i have the following entities: Entity A: @Entity( tableName = "a_table" ) data class A( val name: String ) { @PrimaryKey(autoGenerate = true) @ColumnInfo(name = "a_id") ...
0
votes
2answers
21 views

I need help to create a single line query from a single table

I have a table with column names 'department_name' and 'faculty_name'. A department can have multiple faculties. I want the query result to show the department_name and and the number of faculties on ...
1
vote
1answer
61 views

Implementing Many to Many Relationships on Firestore

I need to model a many-to-many relation on Firestore. A summary of the requirements follow. A company can hire many contractors for a project. A contractor can work for many companies on different ...
0
votes
0answers
28 views

Question: Specification Query Syntax For ManyToMany entities

I want to find All the objects of class A (class A has a Many To Many Relationship with class B) , which have at least one Object of the Set of the Objects of Class B with a certain value in a field . ...
0
votes
2answers
42 views

How do I order a field's returned objects by default after defining a through model?

Summary Defining get_queryset() as below is not ordering objects with order integer as expected. I expect it to order is item.order1 item.order2 item.order 3, but I actually get 12,1,6. or even 8,13,...
1
vote
1answer
34 views

How to handle a post-save signal for an M2M relationship with model inheritance in Django?

The question title is quite the sentence, but hopefully the code below will clear it up: class Foo(models.Model): ... class AbstractParent(models.Model): foos = models.ManyToManyField( ...
0
votes
3answers
32 views

obj.authors.all() doesn't show anything

I'm trying to make a django site in the latest version of django, but when i use the obj.authors.all() it returns nothing. I have tried getting rid of the all() but returns empty Queryset. views.py ...
1
vote
0answers
29 views

Why Django QuerySet didn't support join with manyTomany?

How can I generate SQL like snippet 1-2? Why Django support only prefetch_related('product_set') without support join with manytomanyField? of course i can make similar queryset like Order.objects....
0
votes
1answer
48 views

How to make the m2m_changed signal atomic in Django?

I have the following models in my project: class Topping(models.Model): name = models.CharField(max_length=255) class Pizza(models.Model): name = models.CharField(max_length=255) ...
0
votes
0answers
10 views

How do I make a post request to a Django ManyToManyField? (Json Array)

I have an API that has an array of other objects that all has a name, like this: [ { "id": 1, "title": "Push Workout Bjarred", "description": "Kör Hårt!", "exercises": [ { ...
-1
votes
1answer
25 views

Properly assembling a drinks database with Django (Many to Many)

I would like to set up a drink database, now I have the problem that the databases are not generated accordingly and I do not know how to do this. i have already tried several things, but ...
0
votes
1answer
63 views

SQLAlchemy many-to-many relationship updating association object with extra column

In my application, a 'set' can have a number of 'products' associated with it. Products listed against a set must have quantities defined. For this many-to-many relationship I have followed the ...
0
votes
0answers
8 views

Pivot table collection not updating after sync

I'm re-implementing the code for an online journal in Laravel 5.8/MySQL. I have a users table and a papers table, which have a many-to-many relationship. I am using jQuery/Ajax to modify the list of ...
0
votes
1answer
44 views

Relationship with the same table (Many to Many?) - Laravel

In my database I have to save people and the data of people that have a relationship with the first. For example: father, mother, son, daughter, etc Then the design of the database, I did it in the ...
0
votes
0answers
50 views

has_many through associations in Rails REST API

So I have the following association but I can't figure out how to create those records in the API class Website < ActiveRecord::Base has_many :specs has_many :ads, :through => :specs end class ...
0
votes
0answers
25 views

How to map a collection of entities by array column of ids

I have two entities A and B. In entity A I have a column of type bigint[] , which contains the ids of B. I want to map them into a class. I've tried @Many to Many, but it needs a cross table. Table ...
0
votes
2answers
19 views

How to return fields of both related models in a Django ManyToMany relation?

I have two models: class P(mdoels.Model): name = models.CharField(null=False,max_length=120) ... class F(mdoels.Model): name = models.CharField(null=False,max_length=120) ... p = ...
0
votes
0answers
19 views

Need Help Implementing CRUD and Many_to_Many relationship with React/Rails app

I'm creating a flashcard app using React/Rails-api combo. The app allows a user to create a deck, create cards and assign them to a deck. This started out as a deck has_many cards and cards belongs_to ...
0
votes
2answers
105 views

Django CreateView With ManyToManyField

I am trying to use a Django CreateView and ultimately update a ManyToMany Field if the user selects a certain value. I can get the form to validate, but ultimately it isn't updating the ...
0
votes
1answer
20 views

How to fix the Argument error cannot convert from class DbApproachFirst.Course to DbApproachFirst.COURSE?

I am using Linq to SQL classes in a homework project and I am trying to insert record into a many-to-many table. The problem is that everything I tried even with entity framework insert or Linq I can ...
1
vote
2answers
28 views

include extra field in nested serializer with throuth model Django

I'm writing a meal tracker, so there are two models, Recipe and Ingredient, which are connected through model RecipeIngredient with extra field quantity. Here's my models.py: class Recipe(models....
0
votes
0answers
23 views

Is this good database design practice for document tracking?

I'm trying to design a database for tracking documents. Every document can have multiple versions and every version has a number of properties associated with it. However, each version can be linked ...
0
votes
1answer
27 views

ManyToMany with composite key with api-platform

I am using Api Platform. I have two entities Player and Team and one entity PlayerHasTeam to represent in the database the date on which the player joined a team. This is my PlayerHasTeam entity : /...
0
votes
2answers
43 views

Django: many-to-many ordering

I have many-to-many server to network through ip relationship: class Server(models.Model): hostname = models.CharField(max_length=50) networks = models.ManyToManyField(Network, through='Ip') ...
0
votes
0answers
34 views

How to convert a iterable variable to single item with groupby in C#

I have a sql query which returns a list of rows from site table(a site belongs to a company); Dictionary<int, List<Site>> contactSites = null; var sites= _dataContext.tContacts ...