Package javax.persistence

Examples of javax.persistence.NonUniqueResultException


        List result = getResultList();
        if (result == null || result.isEmpty())
                throw new NoResultException(_loc.get("no-result", getQueryString())
                        .getMessage());
        if (result.size() > 1)
                throw new NonUniqueResultException(_loc.get("non-unique-result",
                        getQueryString(), result.size()).getMessage());
        try {
            return (X)result.get(0);
        } catch (Exception e) {
                throw new NoResultException(_loc.get("no-result", getQueryString())
View Full Code Here


    protected void throwNoResultException(String message) {
        throw new NoResultException(message);
    }
   
    protected void throwNonUniqueResultException(String message) {
        throw new NonUniqueResultException(message);
    }
View Full Code Here

      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof UnresolvableObjectException ) {
      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
View Full Code Here

        if (users.isEmpty())
            return null;
        else if (users.size() == 1)
            return users.get(0);
        else
            throw new NonUniqueResultException();
    }
View Full Code Here

        List rows = getResultList();
        if (rows.size() == 0) {
            throw new NoResultException();
        }
        if (rows.size() > 1) {
            throw new NonUniqueResultException();
        }

        return rows.get(0);
    }
View Full Code Here

        if (result == null || result.size() == 0) {
            throw new NoResultException();
        }

        if (result.size() > 1) {
            throw new NonUniqueResultException();
        }

        return result.get(0);
    }
View Full Code Here

      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof UnresolvableObjectException ) {
      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
View Full Code Here

    protected void throwNoResultException(String message) {
        throw new NoResultException(message);
    }
   
    protected void throwNonUniqueResultException(String message) {
        throw new NonUniqueResultException(message);
    }
View Full Code Here

      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
      handlePersistenceException( converted );
      return converted;
    }
    else if ( e instanceof UnresolvableObjectException ) {
      EntityNotFoundException converted = new EntityNotFoundException( e.getMessage() );
View Full Code Here

    protected void throwNoResultException(String message) {
        throw new NoResultException(message);
    }

    protected void throwNonUniqueResultException(String message) {
        throw new NonUniqueResultException(message);
    }
View Full Code Here

TOP

Related Classes of javax.persistence.NonUniqueResultException

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.