package com.hibernatemanytomanyrelationship; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.ManyToMany; @Entity public class Courses { @Id private int cid; @Column(name="course_name") private String coursename; @ManyToMany(mappedBy ="courses") private List<Students> students; public int getCid() { return cid; } public void setCid(int cid) { this.cid = cid; } public String getCoursename() { return coursename; } public void setCoursename(String coursename) { this.coursename = coursename; } public List<Students> getStudents() { return students; } public void setStudents(List<Students> students) { this.students = students; } public Courses(int cid, String coursename, List<Students> students) { super(); this.cid = cid; this.coursename = coursename; this.students = students; } public Courses() { super(); // TODO Auto-generated constructor stub } }