Commit 3dad43a9 by Tuomas Riihimäki

do not check invalidated bill slots

1 parent 7b4294fa
......@@ -18,6 +18,7 @@
*/
package fi.codecrew.moya.facade;
import java.util.Calendar;
import java.util.List;
import javax.ejb.EJB;
......@@ -96,8 +97,13 @@ public class PlaceSlotFacade extends IntegerPkGenericFacade<PlaceSlot> {
CriteriaQuery<Long> q = cb.createQuery(Long.class);
Root<PlaceSlot> root = q.from(PlaceSlot.class);
q.select(cb.count(root));
q.where(cb.equal(root.get(PlaceSlot_.product), prod));
Path<Bill> bill = root.get(PlaceSlot_.bill);
Path<Calendar> billexp = bill.get(Bill_.expires);
q.where(cb.equal(root.get(PlaceSlot_.product), prod),
cb.or(cb.isNull(billexp),
cb.greaterThan(billexp, Calendar.getInstance())
)
);
Long count = super.getSingleNullableResult(getEm().createQuery(q));
return count;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!