1 package example; 2 3 import javax.persistence.*; 4 5 import java.util.Collection ; 6 7 17 @Entity 18 @Table(name="amber_query_house") 19 public class House { 20 private long _id; 21 private String _name; 22 23 private Collection _studentList; 24 25 public House() 26 { 27 } 28 29 public House(String name) 30 { 31 _name = name; 32 } 33 34 37 @Id 38 @Column(name="id") 39 @GeneratedValue 40 public long getId() 41 { 42 return _id; 43 } 44 45 48 public void setId(long id) 49 { 50 _id = id; 51 } 52 53 56 @Basic 57 @Column(unique=true) 58 public String getName() 59 { 60 return _name; 61 } 62 63 66 public void setName(String name) 67 { 68 _name = name; 69 } 70 71 74 @OneToMany(mappedBy="house") 75 public Collection <Student> getStudentList() 76 { 77 return _studentList; 78 } 79 80 83 public void setStudentList(Collection <Student> list) 84 { 85 } 86 } 87 | Popular Tags |