Package com.jappstart.exception

Examples of com.jappstart.exception.DuplicateUserException


    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,
View Full Code Here

TOP

Related Classes of com.jappstart.exception.DuplicateUserException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.