1 package org.hibernate.test.annotations.fetch; 3 4 import java.io.Serializable ; 5 import java.util.Date ; 6 import javax.persistence.CascadeType; 7 import javax.persistence.Entity; 8 import javax.persistence.FetchType; 9 import javax.persistence.GeneratorType; 10 import javax.persistence.Id; 11 import javax.persistence.JoinColumn; 12 import javax.persistence.ManyToOne; 13 import javax.persistence.Table; 14 15 18 @Entity 19 @Table(name="Stay") 20 public class Stay implements Serializable  21 { 22 static final long serialVersionUID = 1000101; 23 24 private int id; 26 private Person person; 27 private Date startDate; 28 private Date endDate; 29 private String vessel; 30 private String authoriser; 31 private String comments; 32 33 34 public Stay() { } 36 37 public Stay(int id) 38 { 39 this.id = id; 40 } 41 42 public Stay(Person person, Date startDate, Date endDate, String vessel, String authoriser, String comments) 43 { 44 this.authoriser = authoriser; 45 this.endDate = endDate; 46 this.person = person; 47 this.startDate = startDate; 48 this.vessel = vessel; 49 this.comments = comments; 50 } 51 52 53 public String getAuthoriser() { 55 return authoriser; 56 } 57 58 public void setAuthoriser(String authoriser) { 59 this.authoriser = authoriser; 60 } 61 62 public String getComments() { 63 return comments; 64 } 65 66 public void setComments(String comments) { 67 this.comments = comments; 68 } 69 70 public Date getEndDate() { 71 return endDate; 72 } 73 74 public void setEndDate(Date endDate) { 75 this.endDate = endDate; 76 } 77 78 @Id(generate=GeneratorType.AUTO) 79 public int getId() { 80 return id; 81 } 82 83 public void setId(int id) { 84 this.id = id; 85 } 86 87 @ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.LAZY) 88 @JoinColumn(name="person") 89 public Person getPerson() { 90 return person; 91 } 92 93 public void setPerson(Person person) { 94 this.person = person; 95 } 96 97 public Date getStartDate() { 98 return startDate; 99 } 100 101 public void setStartDate(Date startDate) { 102 this.startDate = startDate; 103 } 104 105 public String getVessel() { 106 return vessel; 107 } 108 109 public void setVessel(String vessel) { 110 this.vessel = vessel; 111 } 112 113 114 } | Popular Tags |