forked from ScottOaks/JavaPerformanceTuning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStockPriceLazyEagerImpl.java
More file actions
170 lines (136 loc) · 3.8 KB
/
Copy pathStockPriceLazyEagerImpl.java
File metadata and controls
170 lines (136 loc) · 3.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
* Copyright (c) 2013,2014 Scott Oaks. All rights reserved.
*/
package net.sdo.stockimpl;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import net.sdo.stock.StockOptionPrice;
import net.sdo.stock.StockPrice;
@Entity
@NamedQueries({
@NamedQuery(name="findAll",
query="SELECT s FROM StockPriceLazyEagerImpl s ORDER BY s.id.symbol"),
@NamedQuery(name="findJoin",
query="SELECT s FROM StockPriceLazyEagerImpl s JOIN FETCH s.optionsPrices ORDER BY s.id.symbol"
)
})
@Table(name="StockPrice")
public class StockPriceLazyEagerImpl implements Serializable, StockPrice {
private static final long serialVersionUID = 1L;
@EmbeddedId
private StockPricePK id;
@Column(precision = 30, scale = 2)
private BigDecimal high;
@Column(precision = 30, scale = 2)
private BigDecimal low;
@Column(precision = 30, scale = 2)
private BigDecimal closingPrice;
@Column(precision = 30, scale = 2)
private BigDecimal openingPrice;
@Column
private boolean isYearHigh;
@Column
private boolean isYearLow;
@OneToMany(mappedBy="stock", fetch=FetchType.LAZY)
private Collection<StockOptionPriceLazyEagerImpl> optionsPrices;
public void setClosingPrice(BigDecimal closingPrice) {
this.closingPrice = closingPrice;
}
public void setHigh(BigDecimal high) {
this.high = high;
}
public void setIsYearHigh(boolean isYearHigh) {
this.isYearHigh = isYearHigh;
}
public void setIsYearLow(boolean isYearLow) {
this.isYearLow = isYearLow;
}
public void setLow(BigDecimal low) {
this.low = low;
}
public void setOpeningPrice(BigDecimal openingPrice) {
this.openingPrice = openingPrice;
}
public StockPriceLazyEagerImpl() {
}
StockPriceLazyEagerImpl(StockPricePK pk) {
id = pk;
}
@Override
public Date getDate() {
return id.getDate();
}
@Override
public String getSymbol() {
return id.getSymbol();
}
@Override
public BigDecimal getClosingPrice() {
return closingPrice;
}
@Override
public BigDecimal getHigh() {
return high;
}
@Override
public boolean isYearHigh() {
return isYearHigh;
}
@Override
public boolean isYearLow() {
return isYearLow;
}
@Override
public BigDecimal getLow() {
return low;
}
@Override
public BigDecimal getOpeningPrice() {
return openingPrice;
}
@Override
public Collection<? extends StockOptionPrice> getOptions() {
return optionsPrices;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public StockPricePK getId() {
return id;
}
public void setId(StockPricePK id) {
this.id = id;
}
@Override
public int hashCode() {
int hash = 0;
hash += (id != null ? id.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
if (!(object instanceof StockPriceLazyEagerImpl)) {
return false;
}
StockPriceLazyEagerImpl other = (StockPriceLazyEagerImpl) object;
if ((this.id == null && other.id != null) ||
(this.id != null && !this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "net.sdo.StockPrice[ id=" + id + " ]";
}
}