01: package app.data;
02:
03: import javax.persistence.Column;
04: import javax.persistence.Entity;
05: import javax.persistence.ManyToOne;
06:
07: import com.avaje.ebean.annotation.Sql;
08: import com.avaje.ebean.annotation.SqlSelect;
09:
10: @Entity
11: @Sql(select={@SqlSelect(columnMapping="x.status_code as status, count(*) as count",query="select x.status_code, count(*) from b_bug x group by x.status_code"),@SqlSelect(name="withAssigned",query="select user_assigned_id as assigned, status_code as status, count(*) as count " + "from b_bug " + "group by user_assigned_id, status_code"),@SqlSelect(name="assignedStatusCount",extend="withAssigned",where="status = :status",having="count > :count")})
12: public class BugReport {
13:
14: @ManyToOne
15: BugStatus status;
16:
17: int count;
18:
19: @ManyToOne
20: User assigned;
21:
22: public int getCount() {
23: return count;
24: }
25:
26: public void setCount(int count) {
27: this .count = count;
28: }
29:
30: public User getAssigned() {
31: return assigned;
32: }
33:
34: public void setAssigned(User assigned) {
35: this .assigned = assigned;
36: }
37:
38: public BugStatus getStatus() {
39: return status;
40: }
41:
42: public void setStatus(BugStatus status) {
43: this.status = status;
44: }
45:
46: }
|