//if this was the real world we would sent a mail to the user that this todo list was just shared with him.
//but this is _only_ a demo.
final TypedQuery<TodoListUser> query = entityManager.createNamedQuery("userByEmail", TodoListUser.class);
query.setParameter("email", email);
TodoListUser user;
try {
user = query.getSingleResult();
} catch (NoResultException exception) {
throw new UnknownUserException("user with email '" + email + "' is not a registered user");
}