Commit bf90958f by Tuomas Riihimäki

All places might not have a map

1 parent d39c210f
......@@ -30,6 +30,7 @@ import javax.persistence.criteria.*;
import fi.codecrew.moya.beans.EventBean;
import fi.codecrew.moya.model.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -64,9 +65,11 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
Root<Place> root = cq.from(Place.class);
LanEvent event = eventBean.getCurrentEvent();
cq.where(
cb.equal(root.get(Place_.id), id),
cb.equal(root.get(Place_.map).get(EventMap_.event), eventBean.getCurrentEvent())
cb.or(cb.equal(root.get(Place_.map).get(EventMap_.event), event),
cb.equal(root.get(Place_.product).get(Product_.event), event))
);
return super.getSingleNullableResult(getEm().createQuery(cq));
}
......@@ -308,8 +311,7 @@ public class PlaceFacade extends IntegerPkGenericFacade<Place> {
cb.equal(placeJoin.get(Place_.map).get(EventMap_.event), eventBean.getCurrentEvent())
);
ProductFlag[] flags = {ProductFlag.CREATE_NEW_PLACE_WHEN_BOUGHT};
ProductFlag[] flags = { ProductFlag.CREATE_NEW_PLACE_WHEN_BOUGHT };
cq.where(
cb.or(
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!