How to use join in tables with JPA? [duplicate]

0

I have two tables, one is called project and the other is called employee, I already have them mapped, but I need to have a third table with the name of EMP_PROJ equal to the wikibooks Java Persistence , I made a few attempts but did not succeed.

What I would like is to know what the mapping of the three tables will look like.

In my project the employee is like this;

@Entity
@Table(name = "employee")
public class Employee {
    @Id
    @Column(name="ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull
    @Size(min = 2, max = 300)
    private String name;

    @NotNull
    private BigDecimal salary;

And the project looks like this;

@Entity
@Table(name = "project")
public class Project {

    @Id
    @Column(name="ID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    @NotNull
    @Size(min = 2, max = 300)
    private String name;
    
asked by anonymous 17.09.2018 / 19:09

0 answers