Query q_from = new Query(ACCOUNT_KIND);
q_from.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, from);
q_from.setKeysOnly();
PreparedQuery pq_from = datastore.prepare(q_from);
Entity e_from = pq_from.asSingleEntity();
Key from_key = e_from.getKey();
Query q_to = new Query(ACCOUNT_KIND);
q_to.addFilter(ACCOUNT_ID_PROPERTY, FilterOperator.EQUAL, to);
q_to.setKeysOnly();
PreparedQuery pq_to = datastore.prepare(q_to);
Entity e_to = pq_to.asSingleEntity();
Key to_key = e_to.getKey();
Query sub_from = new Query(SUBSCRIPTION_KIND);
sub_from.setAncestor(from_key);
sub_from.addFilter(SUBSCRIPTION_EMAIL_PROPERTY, FilterOperator.EQUAL, to);
sub_from.addFilter(SUBSCRIPTION_STATUS_PROPERTY, FilterOperator.EQUAL, SUBSCRIPTION_STATUS_ACTIVE);