ManyToMany « Composite « JPA Q&A





1. Hibernate @ManyToMany mapping with composite keys    stackoverflow.com

I'm trying to map a ManyToMany relationships between 2 tables, both having composite primary keys

LSFOCTB which primary key is composed of : LSFOC_CODSOC,LSFOC_CODLSC,LSFOC_CODFOC

LSFORTB which primary key is composed of : ...

2. ManyToMany in Hibernate without composite keys    stackoverflow.com

I am dealing with legacy database. And I am writing unit test using pojos & hibernate & HSQLDB. And I am getting the following error:

17:09:03,946 ERROR SchemaExport:349 - Attempt to define ...

3. @ManyToMany of two entities with composite keys that share a field    stackoverflow.com

Two entities:

public class Employee {
  Company company;
  Long employeeId;
}
public class Project {
  Company company;
  Long projectId;
  Collection<Employee> employees;
}
Three tables:
  • Project whose primary key is {companyId,projectId}
  • Employee whose ...

4. JPA auto_increment id for generated @ManyToMany join table    stackoverflow.com

If I have a bidirectional @ManyToMany relationship between two entities (ie Student and Course), JPA generates a join table, student_id_course_id, with a composite primary key of (student_id, course_id). That all works ...

5. ManyToMany with Composite Key    forum.hibernate.org

Hi, I'm trying to map a unidirectional many-to-many association. I want to retrieve Items from Category object. It works ok if the composite key in linking table forms out of Category PK and Item PK. However, if the linking table only has partial key from Category and pk from Item, then I gets the following error: A Foreign key refering Category ...

6. Multiple ManyToMany-relationships. Composite key in join tab    forum.hibernate.org

Hi, it seems that I try something that anyone tried before. At least Google shows that there were nobody trying this ;) I have an entity with three many-to-may-relationships. The join tables only contain the ids of the two joined tables. Code: COMPONENT { COMPONENT_ID(number), ... } LANGUAGE { ...