Hibernate操纵视图详解
Hibernate操纵视图
①有如下视图:
②hibernate逆向生成之后的代码如下:
CountView.java
1. package com.yaxing.entity;
2.
3. /**
4. * CountView entity. @author MyEclipse Persistence Tools
5. */
6.
7. public class CountView implements java.io.Serializable {
8.
9. // Fields
10.
11. private CountViewId id;
12.
13. // Constructors
14.
15. /** default constructor */
16. public CountView() {
17. }
18.
19. /** full constructor */
20. public CountView(CountViewId id) {
21. this.id = id;
22. }
23.
24. // Property accessors
25.
26. public CountViewId getId() {
27. return this.id;
28. }
29.
30. public void setId(CountViewId id) {
31. this.id = id;
32. }
33.
34. }
CountViewId.java
1. package com.yaxing.entity;
2.
3. /**
4. * CountViewId entity. @author MyEclipse Persistence Tools
5. */
6.
7. public class CountViewId implements java.io.Serializable {
8.
9. // Fields
10.
11. private Integer countAthlete;
12. private Integer countTeam;
13. private long eveId;
14. private String race;
15. private long userId;
16. private long id;
17.
18. // Constructors
19.
20. /** default constructor */
21. public CountViewId() {
22. }
23.
24. /** minimal constructor */
25. public CountViewId(long id) {
26. this.id = id;
27. }
28.
29. /** full constructor */
30. public CountViewId(Integer countAthlete, Integer countTeam, long eveId,
31. String race, long userId, long id) {
32. this.countAthlete = countAthlete;
33. this.countTeam = countTeam;
34. this.eveId = eveId;
35. this.race = race;
36. this.userId = userId;
37. this.id = id;
38. }
39.
40. // Property accessors
41.
42. public Integer getCountAthlete() {
43. return this.countAthlete;
44. }
45.
46. public void setCountAthlete(Integer countAthlete) {
47. this.countAthlete = countAthlete;
48. }
49.
50. public Integer getCountTeam() {
51. return this.countTeam;
52. }
53.
54. public void setCountTeam(Integer countTeam) {
55. this.countTeam = countTeam;
56. }
57.
58. public long getEveId() {
59. return this.eveId;
60. }
61.
62. public void setEveId(long eveId) {
63. this.eveId = eveId;
64. }
65.
66. public String getRace() {
67. return this.race;
68. }
69.
70. public void setRace(String race) {
71. this.race = race;
72. }
73.
74. public long getUserId() {
75. return this.userId;
76. }
77.
78. public void setUserId(long userId) {
79. this.userId = userId;
80. }
81.
82. public long getId() {
83. return this.id;
84. }
85.
86. public void setId(long id) {
87. this.id = id;
88. }
89.
90. public boolean equals(Object other) {
91. if ((this == other))
92. return true;
93. if ((other == null))
94. return false;
95. if (!(other instanceof CountViewId))
96. return false;
97. CountViewId castOther = (CountViewId) other;
98.
99. return ((this.getCountAthlete() == castOther.getCountAthlete()) || (this
100. .getCountAthlete() != null
101. && castOther.getCountAthlete() != null && this
102. .getCountAthlete().equals(castOther.getCountAthlete())))
103.
补充:软件开发 , Java ,