Questions tagged [associative-table]

19 questions
9
votes
3 answers

"Master" associative table?

Consider a model for matching clients and sevices. Clients may be both providers of and consumers of services at various times. Clients may be individuals or groups (companies), the latter having multiple contacts. Contacts may have multiple…
3
votes
3 answers

MySQL many to many relationship matching

I'm making a cocktail database, and right now I have three tables: drinks has columns drinks_id and drinks_name ingredients has columns ingredients_id and ingredients_name The third is a simple relationship table called recipes that has drinks_id…
caltangelo
  • 264
  • 1
  • 11
3
votes
1 answer

SQL insert to fill an associative table with conditions

I have two tables and an associative table between them (let's call them Tab1, Tab2 and ATab). Tab1 and Tab2 have those very same fields (for example purpose) : Id. Name. In my ATab, I want to insert record to associates Tab1 and Tab2 with their…
Andy M
  • 5,945
  • 7
  • 51
  • 96
2
votes
5 answers

Using MYSQL Associative Table and JOIN

Here is the structure of the three tables: CREATE TABLE `contacts` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(99) DEFAULT NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1; CREATE TABLE…
tlaffoon
  • 65
  • 2
  • 10
2
votes
1 answer

How to persisting attributes in an Associative Table using JPA and Hibernate?

I want to save attributes on an associative table in hibernate and don't know how. I came up with the following example: I have a table USERS, a table MEDIA (where movies and books are stored) and an associative table called USER_MEDIA where I store…
user689842
1
vote
1 answer

nested exception is org.hibernate.AnnotationException: mappedBy reference an unknown target entity property

Based on this tutorial I'm trying to create Many-to-Many Relationship Using a Composite Key Eventually I get the following error The composite key itself have the following structure: @Embeddable @Data public class MovieRatingsKey implements…
1
vote
1 answer

Getting and inserting AUTO INCREMENTED rows into an associative-table?

I have two inputs: Basket Name: AND Fruits