1 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 ; 11 12 16 @Entity 17 @NamedQuery(name="night.moreRecentThan", queryString="select n from Night n where n.date >= :date") 18 public class Night { 19 private Integer id; 20 private long duration; 21 private Date date; 22 private Area area; 23 24 @Id(generate = GeneratorType.AUTO) 25 public Integer getId() { 26 return id; 27 } 28 29 public void setId(Integer 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 getDate() { 44 return date; 45 } 46 47 public void setDate(Date 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 |