KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > test > annotations > query > Night


1 //$Id: Night.java,v 1.2 2005/05/13 19:48:43 epbernard Exp $
2
package org.hibernate.test.annotations.query;
3
4 import javax.persistence.Column;
5 import javax.persistence.Entity;
6 import javax.persistence.GeneratorType;
7 import javax.persistence.Id;
8 import javax.persistence.NamedQuery;
9 import javax.persistence.ManyToOne;
10 import java.util.Date JavaDoc;
11
12 /**
13  * Entity declaring a named query
14  * @author Emmanuel Bernard
15  */

16 @Entity
17 @NamedQuery(name="night.moreRecentThan", queryString="select n from Night n where n.date >= :date")
18 public class Night {
19     private Integer JavaDoc id;
20     private long duration;
21     private Date JavaDoc date;
22     private Area area;
23
24     @Id(generate = GeneratorType.AUTO)
25     public Integer JavaDoc getId() {
26         return id;
27     }
28
29     public void setId(Integer JavaDoc id) {
30         this.id = id;
31     }
32
33     @Column(name="night_duration")
34     public long getDuration() {
35         return duration;
36     }
37
38     public void setDuration(long duration) {
39         this.duration = duration;
40     }
41
42     @Column(name="night_date")
43     public Date JavaDoc getDate() {
44         return date;
45     }
46
47     public void setDate(Date JavaDoc date) {
48         this.date = date;
49     }
50
51     @ManyToOne
52     public Area getArea() {
53         return area;
54     }
55
56     public void setArea(Area area) {
57         this.area = area;
58     }
59 }
60
Popular Tags