public final void addUser(final UserAccount user, final Locale locale) {
final UserAccount cachedUser = (UserAccount) memcacheService.get(
user.getUsername());
if (cachedUser != null) {
throw new DuplicateUserException();
}
final Query query = entityManager.createQuery(
"SELECT u FROM UserAccount u WHERE username = :username");
query.setParameter(USERNAME, user.getUsername());
@SuppressWarnings("unchecked")
final List results = query.getResultList();
if (results != null && !results.isEmpty()) {
throw new DuplicateUserException();
}
entityManager.persist(user);
memcacheService.put(user.getUsername(), user,