Package org.springframework.dao

Examples of org.springframework.dao.EmptyResultDataAccessException


        int[] updateCounts = results.get(0).getUpdateCounts();

        for (int i = 0; i < updateCounts.length; i++) {
          int value = updateCounts[i];
          if (value == 0) {
            throw new EmptyResultDataAccessException("Item " + i + " of " + updateCounts.length
                + " did not update any rows: [" + items.get(i) + "]", 1);
          }
        }
      }
    }
View Full Code Here


  @NotNull
  public T findById( @NotNull Long id ) throws DataAccessException {
    T found = type.cast( getHibernateTemplate().get( type, id ) );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

  public final R find( @NotNull Session session ) throws DataAccessException {
    Criteria criteria = createCriteria( session );
    addRestrictions( criteria );
    R found = execute( criteria );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

    // Check for well-known PersistenceException subclasses.
    if (ex instanceof EntityNotFoundException) {
      return new JpaObjectRetrievalFailureException((EntityNotFoundException) ex);
    }
    if (ex instanceof NoResultException) {
      return new EmptyResultDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof NonUniqueResultException) {
      return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof OptimisticLockException) {
View Full Code Here

  public final R find( @NotNull Session session ) throws DataAccessException {
    Criteria criteria = createCriteria( session );
    addRestrictions( criteria );
    R found = execute( criteria );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

  @Override
  @NotNull
  public T findById( @NotNull Long id ) throws DataAccessException {
    T found = type.cast( getHibernateTemplate().get( type, id ) );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

  @Override
  @Nonnull
  public T findById( @Nonnull Long id ) throws DataAccessException {
    T found = type.cast( getHibernateTemplate().get( type, id ) );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

  public final R find( @Nonnull Session session ) throws DataAccessException {
    Criteria criteria = createCriteria( session );
    addRestrictions( criteria );
    R found = execute( criteria );
    if ( found == null ) {
      throw new EmptyResultDataAccessException( 1 );
    }
    return found;
  }
View Full Code Here

    query.setParameter("userId", userId);
    query.setParameter("providerId", providerId);
    query.setParameter("providerUserId", providerUserId);
    List<RemoteUser> userList = query.getResultList();
    if (userList.size() == 0) {
      throw new EmptyResultDataAccessException(1);
    }
    return userList.get(0);

  }
View Full Code Here

    // Check for well-known PersistenceException subclasses.
    if (ex instanceof EntityNotFoundException) {
      return new JpaObjectRetrievalFailureException((EntityNotFoundException) ex);
    }
    if (ex instanceof NoResultException) {
      return new EmptyResultDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof NonUniqueResultException) {
      return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof OptimisticLockException) {
View Full Code Here

TOP

Related Classes of org.springframework.dao.EmptyResultDataAccessException

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.