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.
8,698
questions
0
votes
0
answers
5
views
Keep unmatching monthly values from two tables in a many to many scenario in pyspark
I have two tables 'Solution' and 'Project'. There is a many to many relationship between them. Both tables are tracking 'revenue' at monthly level but there can be certain months where Solution only ...
1
vote
1
answer
21
views
Django: Relationship between 3 models
I'm working on an app for construction company, and I want to create our daily schedule. For this matter, I have 3 models Date, Construction_site and Machinery. Each day we are working on several ...
0
votes
0
answers
16
views
Many to Many between multiple Tables
I'm dealing with a scenario where users can be associated with specific products in distinct roles. This implies that UserA can be involved with ProductB in the capacity of RoleC, and likewise, UserA ...
0
votes
0
answers
56
views
How to get all likes of my vacancies ordered by updatedAt in SQL?
I have a few tables
Users
id
email
vacancies
vacanciesLiked
1
1@gmail.com
(many vacancies to one user)
@HasMany(() => Vacancy)
vacancies: Vacancy[];
(many vacancies to many users)
@...
0
votes
1
answer
30
views
Multiple relations in a single table using JPA
Using SpringBoot 2.7.6 I'm trying to do a multiple relationship stored in one table.
I have one entity that is related with many entities in my DB.
Great Entity
@Entity
@Table(name = "...
0
votes
0
answers
15
views
Django many-to-many fields and ModelForms
I am now working on a system that is calculating the CO2 emissions of a building. The thresholds are calculated taking into consideration the building type and the area of it. One building can have ...
1
vote
1
answer
25
views
Laravel Order by Pivot Table Timestamp, Many to Many Relation
I am currently ordering by the timestamp of a model (the Url model) but I want to order by the timestamp of the pivot table instead. Tried a few things but no dice. Can someone help see where I'm ...
0
votes
1
answer
31
views
Rails Console How do I get records in a many to many relationship
rails 6.1 ruby 3.1.1
I have a many to many relationships inside a sub-directory (namespaced) ...living_muay_thai. I have three tables: students, levels, and student_levels. I have records created in ...
0
votes
0
answers
7
views
Relation_aggregate in QGIS in M:N relationship
I have table1 Troncon and table2 Ligne_offre who are related through a 3rd Intermediate table link_troncon_ligne_offre, because its a M to N relationship. In the table 1, I have a field niveau_offre. ...
0
votes
0
answers
43
views
Java Spring Data Many-to-Many returns the result skipping first entity
I'm new to spring data and am currently trying to create a simple bookstore application with different relationship. I have many-to-many relationship between Book and Author
When I call findAll spring ...
0
votes
0
answers
39
views
Django: create an object with m2m fields using class based views
I'm completely stuck, I want to know the right way to save an object that has m2m fields.
It works with the admin site (not quite right: a field that should be chosen randomly is chosen through a ...
0
votes
0
answers
29
views
Which Relationship between Django Models
I'm trying to code a DB based web app with Python/Django and I have some issues figuring out which is the best approach for my purpose, so I'll try to explain myself the best way possible.
The DB ...
0
votes
1
answer
40
views
Django Rest Framework Many to Many field data from frontend
models.py
class PostCategory(models.Model):
name = models.CharField(max_length=200, unique=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
def __str__(self):
return ...
0
votes
1
answer
33
views
How to create a DjangoModel Form with a model that contains FKs and M2M relationships
I have seen posts that talk about this scenario separately but they seem to be very old, using old documentation. I am here wondering if there is a new fix. Also I'm relatively new to django and they ...
-4
votes
0
answers
25
views
Many-to-many relationship implementation without using extra table [duplicate]
I have 2 tables - master_city and lender_child. Every city in master city table is to be linked with all the lenders in lender_child. For example if master city contains entries such as Goa and UP, ...
0
votes
0
answers
14
views
Three/four-level entity relationship: Gallery/Exhibit/Painting/ExhibitPaintingDetail
ERD for tables involved here is at https://4l3c78.axshare.com/#g=1&p=data
This is a nextjs/typeorm project. How are the relationships in the entities Exhibit, Painting, ExhibitPaintingDetail? The ...
0
votes
0
answers
30
views
Spring Boot JPA Many to Many Join Table Exception
I tried many JPA many to many examples but none of them works, this is what I have to use join table to implement the many to many model:
its running on 3.0.9 spring boot framework
build.gradle
...
0
votes
1
answer
32
views
Problem with table name in Laravel Eloquent many to many relathionship
I am implementing a many to many relationship between 'suppliers' and 'brands' table. my Models are Supplier, Brand, BrandSupplier. my tables are suppliers, brands, brand_suppliers. I know that ...
0
votes
3
answers
43
views
Django ManyToMany get error 'Object of type QuerySet is not JSON serializable'
i have this issue on my application.
Object of type QuerySet is not JSON serializable
In fact, i creating an application in which we have a relationship of the type several Products inone or more ...
0
votes
1
answer
71
views
Laravel Filament handle relationship data before saving
I have a question: in a Filament Form I have a manyToMany relationship rendered with a Checkboxlist. Before the db saving, I have to perform some "actions" with the values inside the list.
...
0
votes
2
answers
65
views
Java | JPA | Hibernate | AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class
I'm getting my feet wet with Java Spring Boot 2.7.15 and I'm having a bit of trouble. I've applied several solutions but they all lead back to the same error in the title.
Some background:
I'm ...
0
votes
0
answers
14
views
How Do I Model a Fact that is Related to Many Dimensions in my Data Warehouse Design
I am building a data warehouse for property management. The first fact table is ServiceTicket_FACT where we will keep track of the number of service tickets across various dimensions. One of the ...
0
votes
1
answer
30
views
Can I use additional fields in TypeOrm many-to-many join table
I have two tables: Painting and Exhibit with tables painting and exhibit whose many-to-many relationships are handled by the exhibit_paintings table - id, paintingId, exhibitId.
Because paintings can ...
0
votes
1
answer
36
views
ManyToMany Relationship with composite primary key in Quarkus Hibernate
I am currently building a Quarkus Backend and can't figure out how to map a ManyToMany relationship with additional attributes.
Let's say I have a CorporationEntity and an AddressEntity and I want to ...
0
votes
0
answers
13
views
Spring Boot JPA: Mapping an Entity field with Map<Entity, Integer> causes 'Unsupported Media Type' error
Working on a Spring Boot application where I have an Drone entity with a field "medications" that I'm trying to map as a Map<Medication, Integer>. The goal is to associate medications ...
0
votes
1
answer
24
views
How do I get Access to recognize duplicates in data entries? (many-to-many relationships)
tl;dr: How do I make sure that Access doesn't create two rows in the Keywords table for this entry and instead recognizes that it's the same and assigns it the same KeywordID?
More info:
I have ...
0
votes
0
answers
17
views
creating new relationship to a a resource in json api
I have room resource and inside room there are multiple features which are reference to this room. i am using subrequest to make changes to it but it does modify the relationships. here is my code:
...
0
votes
1
answer
16
views
Error when trying to insert many-to-many after saving new entity in Entity Framework
The problem that I'm stuck on consists of the following steps. I hesitate which approach is the right one - I want to save a new entity, part of many-to-many relation. After saving it I want to update ...
0
votes
0
answers
31
views
laravel 9 error in many to many relationship
I am new to Laravel and I just started learning php and laravel 9 material for many to many relationship, But I am having trouble with an error, what I want to ask is, on the actual page, it should ...
0
votes
1
answer
29
views
Add extra fields in ManyToMany relationship Symfony 6
Hi so i created a many to many relationship between 2 entities named client and offre
here is my entity client :
#[ORM\ManyToMany(targetEntity: Offre::class, inversedBy: 'clients')]
#[ORM\JoinColumn(...
0
votes
1
answer
24
views
Mapstruct - how to create generated code to add when we have many to many entity
I try use mapstruct to save my DTO to entity. In the basic relations I had no problem with the generated code, but needs help with the generation in the relation many to many.
My entity:
Hero
@...
0
votes
0
answers
13
views
Inserting data to a implicit many-to-many relationship in Prisma
I am building a website similar to LinkedIn/indeed and am facing difficulties when trying to update a job row when a user applies to a job. I am using Nest.js, Postgres and Prisma as the ORM.
Here are ...
0
votes
1
answer
43
views
Android room many to many relationship returns to many results
I have a many to many relationship defined in android room. The junction table contains additional attributes, but i think that doesn't matter here.
When I execute my db query, i get to many result. ...
0
votes
0
answers
22
views
Establishing a many to many association with the .build method
I've been banging my head against this for a few days, and I know of a hacky work around but I'm trying to adhere to the "Rails Way" as much as possible.
I have a Connector model, and a ...
2
votes
1
answer
29
views
"Cannot insert the value NULL into column" error in many to many & one to many relationship
I got following configuration:
public class Person
{
// some default values
public ICollection<Location> Locations { get; set; }
public int? LocationId { get; set; }
}
public class ...
0
votes
0
answers
30
views
Many-to-Many relationship, when fetch from database ended up with 0 data though database table has 1
I am working in Spring Boot project with SQLite database.
I have two entities: User and StudyType. They have many-to-many relationship.
I use annotations from jakarta.persistence package to declare ...
0
votes
1
answer
62
views
ASP.NET Core MVC many-to-many CRUD Operations
I am using ASP.NET Core MVC with TagHelpers.
My project has entities called "GroupEntity" , "CustomerEntity" and "GroupsCustomerEntity".
I want to add customers to groups ...
0
votes
2
answers
54
views
Sort Django QuerySet by the combination of string fields from a M2M relationship
Suppose I have two models connected with a many-to-many relationship.
class Bar(models.Model):
name = models.CharField()
class Foo(models.Model):
name = models.CharField()
bars = models....
-2
votes
1
answer
36
views
Many To Many Relationship in PostgreSQL
There are two tables in a database.
The first table is "users". It has two columns. A user_id column and a sector_id column.
It is possible for a user to follow multiple sectors. Which ...
0
votes
0
answers
25
views
Django: Filter ManyToMany Relationship and must include Parent
If User Selects Product Sub Category as Private Car and State as Andaman And Nicobar Islands, I want to Display only those unique RTOs which matches in both Product Sub Category and State.
View:
...
-1
votes
1
answer
38
views
Why not always use One-to-Many instead of Many-to-Many?
I'm trying to learn about postgres and relationships. So let's take a very common example. Say we have a Users table and a Products table. I know that the classic way to go about it is to phrase the ...
0
votes
0
answers
15
views
accesing many to many fields in django
i am trying to build a clothes online store as a fun side project while studying django, i have products each of these products has multiple instances where each instance has a color and a size, like ...
0
votes
0
answers
20
views
In Laravel, how to attach many to many with an extra field from the pivot table
I have looked at several posts on the subject but I am confused.
I have 2 tables (activities & criteria) and a pivot table with an extra field (sortorder). My models are like this:
// return all ...
1
vote
2
answers
35
views
Access transparent EF managed join entity (many to many relationship) without class/DbSet
I have taken the code first approach (EF Core 7.0). I have not explicitly defined the join entity using a class. Now I want to access the join entity and delete or add some rows there, which I am not ...
1
vote
0
answers
33
views
In EF Core when adding a many-to-many relationship, the related entities are updated
In EF Core, when I add entities in a many-to-many relationship, the relationships are created, but the added entities are also updated while there is no reason to do so (I don't modify these entities)....
3
votes
1
answer
26
views
Why Django Rest API serializers diden't serialize many to many fields correctly
the problem is in OrderProdSerializer class , whene i try to get some informations from OrderProd models i can get the id correctly but it ignore the other fields like "quantity" and "...
0
votes
0
answers
23
views
Many to Many Relationship laravel Column x Row from database [pivot]
Get Column from customertypes table , and show value from customerprices table with lastest one only. how to get last value from pivot table.
***customertypes tbl***
| id | name |
| 1 | Retail ...
0
votes
1
answer
22
views
How to limit results from a query with join and where
I'm using MySQL.
There are two tables titles and genres, where the two types of records have a many to many relationship. So there is also a third table called title_genre_relationships.
I'd like to ...
0
votes
0
answers
26
views
Spring boot many to many relationship, query the join table
I have some specific questions regarding the many to many relationship in spring boot.
I have these two entities:
Book:
@Entity
@Table(name = "books")
@Data
@AllArgsConstructor
@...
1
vote
1
answer
29
views
Django filter on many to many with having count
After a lot of try, I am not able to translate this kind of sql queries into django filtering.
Basically, it is retrieving all users with at least x selected tags (and other filters).
In the case of ...