Good evening
I am having trouble mapping my database
The database looks like below
employe(id_employe,Adress,Mail…)
event(id_ev,title_ev…,id_employe)
participer(id_evenement,id_employe)
and my entites
@Entity
@Table(name="event")
public class Event {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id_ev;
private String title_ev;
@ManyToOne
`private Employe employeId;`
`@ManyToMany`
`@JoinTable(`
`name = "Participer",`
`joinColumns = {@JoinColumn(name = "id_evenement") },`
`inverseJoinColumns = {@JoinColumn(name = "id_employe") })`
`List<Employe> employes=new ArrayList<Employe>();`
//getters and setters
@Entity
@Table(name="employe")
public class Employe {
@ManyToMany(cascade = { CascadeType.ALL },mappedBy="employes")
List<Event> Event=new ArrayList<Event>();
//getters and setters
everything works very well but when I insert in the table participer and i want to display all the events it gives me an error
i think the problem is that i have two object employe used in the same table but it is necessary because an employee can create a lot of events and participate on many events.
And thanks for your help