@Override
    public void markNotificationsWithStatusById(String recipientUserId, List<Long> idList, NotificationStatus status) throws StorageException {
        int n = getActiveEntityManager()
             .createQuery(
                  "UPDATE NotificationEntity n "
                       + "SET n.status = :newStatus, "
                       + "    n.modifiedOn = :now "
                       + "WHERE n.recipient = :recipientId "
                       + "AND n.id IN :idList"
             )
             .setParameter("newStatus", status)
             .setParameter("now", OffsetDateTime.now())
             .setParameter("recipientId", recipientUserId) // This ensures you can't mark someone else's notifications as read.
             .setParameter("idList", idList)
             .executeUpdate();
        LOGGER.debug("Marked all unread notifications for recipient {0} to status {1}, "
             + "this affected {2} records.", recipientUserId, status, n);
    }
Storage for simple notifications system

@author Marc Savy {@literal <marc@blackparrotlabs.io>}
manager/api/jpa/src/main/java/io/apiman/manager/api/jpa/NotificationRepositoryImpl.java