fix exception when renaming a subscription with no parent category

This commit is contained in:
Athou
2013-06-28 06:38:54 +02:00
parent 97f3efbf7c
commit 5a907dd093

View File

@@ -100,9 +100,16 @@ public class FeedSubscriptionDAO extends GenericDAO<FeedSubscription> {
Predicate p1 = builder.equal(
root.get(FeedSubscription_.user).get(User_.id), user.getId());
Predicate p2 = builder.equal(
root.get(FeedSubscription_.category).get(FeedCategory_.id),
category.getId());
Predicate p2 = null;
if (category == null) {
p2 = builder.isNull(
root.get(FeedSubscription_.category));
} else {
p2 = builder.equal(
root.get(FeedSubscription_.category).get(FeedCategory_.id),
category.getId());
}
query.where(p1, p2);