1 package example; 2 3 import java.util.Collection ; 4 5 import javax.persistence.*; 6 7 19 @Entity 20 @Table(name="amber_query_student") 21 public class Student { 22 private long _id; 23 private String _name; 24 private String _gender; 25 private House _house; 26 27 public Student() 28 { 29 } 30 31 public Student(String name, String gender, House house) 32 { 33 setName(name); 34 setGender(gender); 35 setHouse(house); 36 } 37 38 41 @Id 42 @Column(name="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 @Column(unique=true) 62 public String getName() 63 { 64 return _name; 65 } 66 67 70 public void setName(String name) 71 { 72 _name = name; 73 } 74 75 78 @Basic 79 @Column(length=1) 80 public String getGender() 81 { 82 return _gender; 83 } 84 85 88 public void setGender(String gender) 89 { 90 _gender = gender; 91 } 92 93 96 @ManyToOne 97 @JoinColumn(name="house") 98 public House getHouse() 99 { 100 return _house; 101 } 102 103 106 public void setHouse(House house) 107 { 108 _house = house; 109 } 110 } 111 | Popular Tags |