private Invite queryForInvite(String token) throws NoSuchInviteException {
try {
return jdbcTemplate.queryForObject(SELECT_INVITE, new RowMapper<Invite>() {
public Invite mapRow(ResultSet rs, int rowNum) throws SQLException {
Invitee invitee = new Invitee(rs.getString("firstName"), rs.getString("lastName"), rs.getString("email"));
ProfileReference sentBy = ProfileReference.textOnly(rs.getLong("sentById"), rs.getString("sentByUsername"), rs.getString("sentByFirstName"), rs.getString("sentByLastName"));
return new Invite(invitee, sentBy, rs.getBoolean("accepted"));
}
}, token, token);
} catch (EmptyResultDataAccessException e) {
throw new NoSuchInviteException(token);