1 package org.kuali.mobility.library.entity;
2
3 import java.util.List;
4
5 import javax.persistence.CascadeType;
6 import javax.persistence.Column;
7 import javax.persistence.Entity;
8 import javax.persistence.FetchType;
9 import javax.persistence.GeneratedValue;
10 import javax.persistence.GenerationType;
11 import javax.persistence.Id;
12 import javax.persistence.JoinColumn;
13 import javax.persistence.ManyToOne;
14 import javax.persistence.NamedQueries;
15 import javax.persistence.NamedQuery;
16 import javax.persistence.OneToMany;
17 import javax.persistence.OrderBy;
18 import javax.persistence.Table;
19
20
21
22
23
24
25
26
27
28 @NamedQueries({
29 @NamedQuery(
30 name="LibraryHourSet.getHourSets",
31 query="SELECT hs FROM LibraryHourSet hs WHERE libraryId = :libraryId ORDER BY hs.period.order")
32
33 })
34 @Entity
35 @Table(name="LIBRARY_HOUR_SET")
36 public class LibraryHourSet {
37
38
39
40
41 @Id
42 @GeneratedValue(strategy = GenerationType.TABLE)
43 @Column(name="ID")
44 private Long id;
45
46
47
48
49 @Column(name="LIBRARY_ID")
50 private long libraryId;
51
52
53
54
55 @ManyToOne(optional=false)
56 @JoinColumn(name="PERIOD_ID", nullable=false, updatable=false)
57 @OrderBy(value="id DESC")
58 private LibraryHourPeriod period;
59
60
61
62
63 @OneToMany(cascade=CascadeType.ALL, mappedBy="libraryHourSet", fetch=FetchType.EAGER)
64 @OrderBy(value="dayOfWeek ASC")
65 private List<LibraryHour> hours;
66
67
68
69
70
71 public Long getId() {
72 return id;
73 }
74
75
76
77
78
79 public void setId(Long id) {
80 this.id = id;
81 }
82
83
84
85
86
87 public long getLibraryId() {
88 return libraryId;
89 }
90
91
92
93
94
95 public void setLibraryId(long libraryId) {
96 this.libraryId = libraryId;
97 }
98
99
100
101
102
103 public LibraryHourPeriod getPeriod() {
104 return period;
105 }
106
107
108
109
110
111 public void setPeriod(LibraryHourPeriod period) {
112 this.period = period;
113 }
114
115
116
117
118
119 public List<LibraryHour> getHours() {
120 return hours;
121 }
122
123
124
125
126
127 public void setHours(List<LibraryHour> hours) {
128 this.hours = hours;
129 }
130
131
132
133
134 }