1 25 package org.objectweb.easybeans.tests.common.ejbs.entity.entitytest03; 26 27 import java.util.Collection ; 28 import java.util.Date ; 29 30 import javax.persistence.Entity; 31 import javax.persistence.Id; 32 import javax.persistence.IdClass; 33 import javax.persistence.ManyToMany; 34 import javax.persistence.ManyToOne; 35 import javax.persistence.PrimaryKeyJoinColumn; 36 import javax.persistence.Temporal; 37 import javax.persistence.TemporalType; 38 39 45 50 @IdClass(ClassPK.class) 51 @Entity 52 @PrimaryKeyJoinColumn(name = "course", referencedColumnName = "courseId") 53 public class Class { 54 55 58 private Course course; 59 60 63 private String classYear; 64 65 68 private String className; 69 70 73 private ClassRoom classRoom; 74 75 78 private Professor professor; 79 80 83 private Collection <Student> students; 84 85 88 private Date startDate; 89 90 93 private Date endDate; 94 95 99 @Temporal(TemporalType.DATE) 100 public Date getEndDate() { 101 return endDate; 102 } 103 104 108 public void setEndDate(final Date endDate) { 109 this.endDate = endDate; 110 } 111 112 116 @Temporal(TemporalType.DATE) 117 public Date getStartDate() { 118 return startDate; 119 } 120 121 125 public void setStartDate(final Date startDate) { 126 this.startDate = startDate; 127 } 128 129 133 @ManyToOne 134 public ClassRoom getClassRoom() { 135 return classRoom; 136 } 137 138 142 public void setClassRoom(final ClassRoom classRoom) { 143 this.classRoom = classRoom; 144 } 145 146 150 public void setStudents(final Collection <Student> students) { 151 this.students = students; 152 } 153 154 158 @Id 159 public String getClassName() { 160 return className; 161 } 162 163 167 public void setClassName(final String className) { 168 this.className = className; 169 } 170 171 175 @Id 176 public String getClassYear() { 177 return classYear; 178 } 179 180 184 public void setClassYear(final String classYear) { 185 this.classYear = classYear; 186 } 187 188 192 @ManyToOne 193 public Course getCourse() { 194 return course; 195 } 196 197 201 public void setCourse(final Course course) { 202 this.course = course; 203 } 204 205 209 @ManyToOne 210 public Professor getProfessor() { 211 return professor; 212 } 213 214 218 public void setProfessor(final Professor professor) { 219 this.professor = professor; 220 } 221 222 226 @ManyToMany(mappedBy = "currentCours") 227 public Collection <Student> getStudents() { 228 return students; 229 } 230 231 } 232 | Popular Tags |