1 package example; 2 3 import java.util.Collection ; 4 5 import javax.persistence.*; 6 7 19 @Entity 20 @Table(name="amber_many2many_map") 21 public class Grade { 22 private long _id; 23 private Student _student; 24 private Course _course; 25 private String _grade; 26 27 public Grade() 28 { 29 } 30 31 public Grade(Student student, Course course, String grade) 32 { 33 setStudent(student); 34 setCourse(course); 35 setGrade(grade); 36 } 37 38 41 @Id 42 @Column(name="grade_id") 43 @GeneratedValue 44 public long getId() 45 { 46 return _id; 47 } 48 49 52 public void setId(long id) 53 { 54 _id = id; 55 } 56 57 60 @Basic 61 public String getGrade() 62 { 63 return _grade; 64 } 65 66 69 public void setGrade(String grade) 70 { 71 _grade = grade; 72 } 73 74 77 @ManyToOne 78 @JoinColumn(name="student_id", nullable=false, updatable=false) 79 public Student getStudent() 80 { 81 return _student; 82 } 83 84 87 public void setStudent(Student student) 88 { 89 _student = student; 90 } 91 92 95 @ManyToOne 96 @JoinColumn(name="course_id", nullable=false, updatable=false) 97 public Course getCourse() 98 { 99 return _course; 100 } 101 102 105 public void setCourse(Course course) 106 { 107 _course = course; 108 } 109 } 110 | Popular Tags |