| Line 62... |
Line 62... |
| 62 |
|
62 |
|
| 63 |
@NamedQuery(name = "Order.selectFirstBillingByRetailer",
|
63 |
@NamedQuery(name = "Order.selectFirstBillingByRetailer",
|
| 64 |
query = "select min(o.billingTimestamp) from Order o " +
|
64 |
query = "select min(o.billingTimestamp) from Order o " +
|
| 65 |
"where o.retailerId = :retailerId and o.billingTimestamp >= :minDate"),
|
65 |
"where o.retailerId = :retailerId and o.billingTimestamp >= :minDate"),
|
| 66 |
|
66 |
|
| - |
|
67 |
// Scalar projections for the investment sweep. Order.lineItem is a ManyToOne with
|
| - |
|
68 |
// FetchType.EAGER, so loading Order entities also loads a LineItem for every row - roughly
|
| - |
|
69 |
// 6,800 orders plus 6,800 line items per sweep, all dirty-checked at flush, when the only
|
| - |
|
70 |
// thing wanted is a total per partner. A projection never hydrates the entity, so the eager
|
| - |
|
71 |
// association never fires. Predicates match selectOrders(ids, pendingOrderStatus) and
|
| - |
|
72 |
// selectPendingGrnOrders(ids) exactly; change them together.
|
| - |
|
73 |
@NamedQuery(name = "Order.selectInTransitAmountByRetailers",
|
| - |
|
74 |
query = "select o.retailerId, sum(o.totalAmount) from Order o " +
|
| - |
|
75 |
"where o.retailerId in :retailerIds and o.status in :statuses " +
|
| - |
|
76 |
"group by o.retailerId"),
|
| - |
|
77 |
|
| - |
|
78 |
@NamedQuery(name = "Order.selectPendingGrnAmountByRetailers",
|
| - |
|
79 |
query = "select o.retailerId, sum(o.totalAmount) from Order o " +
|
| - |
|
80 |
"where o.retailerId in :retailerIds " +
|
| - |
|
81 |
"and o.partnerGrnTimestamp is null and o.refundTimestamp is null " +
|
| - |
|
82 |
"and o.billingTimestamp is not null and o.billingTimestamp >= :minDate " +
|
| - |
|
83 |
"group by o.retailerId"),
|
| - |
|
84 |
|
| 67 |
@NamedQuery(name = "Order.selectFirstBillingByRetailers",
|
85 |
@NamedQuery(name = "Order.selectFirstBillingByRetailers",
|
| 68 |
query = "select o.retailerId, min(o.billingTimestamp) from Order o " +
|
86 |
query = "select o.retailerId, min(o.billingTimestamp) from Order o " +
|
| 69 |
"where o.retailerId in :retailerIds and o.billingTimestamp >= :minDate " +
|
87 |
"where o.retailerId in :retailerIds and o.billingTimestamp >= :minDate " +
|
| 70 |
"group by o.retailerId"),
|
88 |
"group by o.retailerId"),
|
| 71 |
|
89 |
|