1 25 package org.objectweb.easybeans.tests.common.ejbs.entity.entitytest03; 26 27 import java.util.Collection ; 28 29 import javax.persistence.Entity; 30 import javax.persistence.GeneratedValue; 31 import javax.persistence.GenerationType; 32 import javax.persistence.Id; 33 import javax.persistence.OneToMany; 34 import javax.persistence.TableGenerator; 35 36 42 @Entity 43 public class Course { 44 45 48 private Long courseId; 49 50 53 private String name; 54 55 58 private int credits; 59 60 63 private Collection <Class > classes; 64 65 69 @OneToMany(mappedBy = "course") 70 public Collection <Class > getClasses() { 71 return classes; 72 } 73 74 78 public void setClasses(final Collection <Class > classes) { 79 this.classes = classes; 80 } 81 82 86 @TableGenerator(name = "courseGen", table = "idTable", allocationSize = 2) 87 @Id 88 @GeneratedValue(strategy = GenerationType.TABLE, generator = "courseGen") 89 public Long getCourseId() { 90 return courseId; 91 } 92 93 97 public void setCourseId(final Long courseId) { 98 this.courseId = courseId; 99 } 100 101 105 public int getCredits() { 106 return credits; 107 } 108 109 113 public void setCredits(final int credits) { 114 this.credits = credits; 115 } 116 117 121 public String getName() { 122 return name; 123 } 124 125 129 public void setName(final String name) { 130 this.name = name; 131 } 132 } 133 | Popular Tags |