- any given employee can be assigned to multiple projects and a project may have multiple employees working for it, leading to a many-to-many association between the two.
- create the employee and project tables along with the employee_project join table with employee_id and project_id as foreign keys
- The model classes Employee and Project need to be created with JPA annotations
- both the Employee class and Project classes refer to one another, which means that the association between them is bidirectional.
- In order to map a many-to-many association, we use the
@ManyToMany,@JoinTableand@JoinColumnannotations. - This association has two sides i.e. the owning side and the inverse side. In our example, the owning side is Employee so the join table is specified on the owning side by using the
@JoinTableannotation in Employee class. The@JoinTableis used to define the join/link table. In this case, it is Employee_Project.
Stories and examples from real life about security and how dangerous can it be but at the same time it is fun.