Examples of NonUniqueResultException


Examples of com.mysema.query.NonUniqueResultException

    @Override
    public T uniqueResult() {
        try {
            return (T) createQuery(false).uniqueResult();
        } catch (org.hibernate.NonUniqueResultException e) {
            throw new NonUniqueResultException();
        }
    }
View Full Code Here

Examples of com.tll.dao.NonUniqueResultException

    final List<E> list = findEntities(criteria, null);
    if(list == null || list.size() < 1) {
      throw new EntityNotFoundException("No matching entity found.");
    }
    else if(list.size() > 1) {
      throw new NonUniqueResultException("More than one matching entity found.");
    }
    assert list.size() == 1;
    return list.get(0);
  }
View Full Code Here

Examples of fi.evident.dalesbred.NonUniqueResultException

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

Examples of javax.persistence.NonUniqueResultException

      else // jpa/1004
        throw new NoResultException("Query returned no results for getSingleResult()");

      // jpa/1005
      if (rs.next())
        throw new NonUniqueResultException("Query returned more than one result for getSingleResult()");

      return value;
    }
    catch (RuntimeException e) {
      throw e;
View Full Code Here

Examples of javax.persistence.NonUniqueResultException

    }
    else if ( e instanceof ObjectNotFoundException ) {
      throwPersistenceException( new EntityNotFoundException( e.getMessage() ) );
    }
    else if ( e instanceof org.hibernate.NonUniqueResultException ) {
      throwPersistenceException( new NonUniqueResultException( e.getMessage() ) );
    }
    else if ( e instanceof UnresolvableObjectException ) {
      throwPersistenceException( new EntityNotFoundException( e.getMessage() ) );
    }
    else if ( e instanceof QueryException ) {
View Full Code Here

Examples of javax.persistence.NonUniqueResultException

        throwPersistenceException( new NoResultException( "No entity found for query" ) );
      }
      else if ( result.size() > 1 ) {
        Set uniqueResult = new HashSet( result );
        if ( uniqueResult.size() > 1 ) {
          throwPersistenceException( new NonUniqueResultException( "result returns " + uniqueResult.size() + " elements" ) );
        }
        else {
          return uniqueResult.iterator().next();
        }
View Full Code Here

Examples of javax.persistence.NonUniqueResultException

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

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

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

Examples of javax.persistence.NonUniqueResultException

  public X getSingleResult() {
    List<X> resultList = getResultList();
    if (resultList.isEmpty()) {
      throw new NoResultException();
    } else if (resultList.size() > 1) {
      throw new NonUniqueResultException("Query produced " + resultList.size() + " results (expected 1)");
    }
    return resultList.get(0);
  }
View Full Code Here

Examples of javax.persistence.NonUniqueResultException

        throw nre;
      }
      else if ( result.size() > 1 ) {
        final Set<X> uniqueResult = new HashSet<X>(result);
        if ( uniqueResult.size() > 1 ) {
          NonUniqueResultException nure = new NonUniqueResultException( "result returns more than one elements" );
          getEntityManager().handlePersistenceException( nure );
          throw nure;
        }
        else {
          return uniqueResult.iterator().next();
View Full Code Here

Examples of javax.persistence.NonUniqueResultException

            EntityExistsException converted = new EntityExistsException( 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
TOP
Copyright © 2018 www.massapi.com. 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.