KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > fetch > Stay


1 //$Id: Stay.java,v 1.1 2005/07/20 00:18:05 epbernard Exp $
2
package org.hibernate.test.annotations.fetch;
3
4 import java.io.Serializable JavaDoc;
5 import java.util.Date JavaDoc;
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 /**
16  * @author Emmanuel Bernard
17  */

18 @Entity
19 @Table(name="Stay")
20 public class Stay implements Serializable JavaDoc
21 {
22     static final long serialVersionUID = 1000101;
23
24     // member declaration
25
private int id;
26     private Person person;
27     private Date JavaDoc startDate;
28     private Date JavaDoc endDate;
29     private String JavaDoc vessel;
30     private String JavaDoc authoriser;
31     private String JavaDoc comments;
32
33
34     // constructors
35
public Stay() { }
36
37     public Stay(int id)
38     {
39         this.id = id;
40     }
41
42     public Stay(Person person, Date JavaDoc startDate, Date JavaDoc endDate, String JavaDoc vessel, String JavaDoc authoriser, String JavaDoc 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     // properties
54
public String JavaDoc getAuthoriser() {
55         return authoriser;
56     }
57
58     public void setAuthoriser(String JavaDoc authoriser) {
59         this.authoriser = authoriser;
60     }
61
62     public String JavaDoc getComments() {
63         return comments;
64     }
65
66     public void setComments(String JavaDoc comments) {
67         this.comments = comments;
68     }
69
70     public Date JavaDoc getEndDate() {
71         return endDate;
72     }
73
74     public void setEndDate(Date JavaDoc 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 JavaDoc getStartDate() {
98         return startDate;
99     }
100
101     public void setStartDate(Date JavaDoc startDate) {
102         this.startDate = startDate;
103     }
104
105     public String JavaDoc getVessel() {
106         return vessel;
107     }
108
109     public void setVessel(String JavaDoc vessel) {
110         this.vessel = vessel;
111     }
112
113
114 }
Popular Tags