Examples of IncorrectResultSizeDataAccessException


Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

    }
    if (ex instanceof WrongClassException) {
      return new HibernateObjectRetrievalFailureException((WrongClassException) ex);
    }
    if (ex instanceof NonUniqueResultException) {
      return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof StaleObjectStateException) {
      return new HibernateOptimisticLockingFailureException((StaleObjectStateException) ex);
    }
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

    }
    if (ex instanceof NoResultException) {
      return new EmptyResultDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof NonUniqueResultException) {
      return new IncorrectResultSizeDataAccessException(ex.getMessage(), 1);
    }
    if (ex instanceof OptimisticLockException) {
      return new JpaOptimisticLockingFailureException((OptimisticLockException) ex);
    }
    if (ex instanceof EntityExistsException) {
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

                public Object doInDirContext(DirContext ctx)
                    throws NamingException {
                    NamingEnumeration results = ctx.search(base, filter, params, searchControls);

                    if (!results.hasMore()) {
                        throw new IncorrectResultSizeDataAccessException(1, 0);
                    }

                    SearchResult searchResult = (SearchResult) results.next();

                    if (results.hasMore()) {
                        // We don't know how many results but set to 2 which is good enough
                        throw new IncorrectResultSizeDataAccessException(1, 2);
                    }

                    // Work out the DN of the matched entry
                    StringBuffer dn = new StringBuffer(searchResult.getName());
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

        assertThat((User)result, is(sameInstance(authUser)));
    }

    @Test(expected = UsernameNotFoundException.class)
    public void loadByUsername_invalid_exception() {
        expect(repository.getByUsername(USER_NAME)).andThrow(new IncorrectResultSizeDataAccessException(1));
        replay(repository);

        service.setAuthenticatedUser(USER_ID);
    }
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

                    final SearchResult result = (SearchResult)userlist.next();
                   
                    //Only allow one result for the query, do the check here to
                    //save on attribute processing time.
                    if (userlist.hasMoreElements()) {
                        throw new IncorrectResultSizeDataAccessException("More than one result for ldap person attribute search.", 1, -1);
                    }

                    final Attributes ldapAttributes = result.getAttributes();
                   
                    //Iterate through the attributes
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

    public Object mapRow(ResultSet rs, int rowNum) throws SQLException {
        ResultSetMetaData rsmd = rs.getMetaData();
        int nrOfColumns = rsmd.getColumnCount();
        if (nrOfColumns != 1) {
            throw new IncorrectResultSizeDataAccessException(
                    "Expected single column but found " + nrOfColumns, 1, nrOfColumns);
        }
        Object result = getJdbcObject(rs, 1);
        if (result != null && this.requiredType != null && !this.requiredType.isInstance(result)) {
            if (String.class.equals(this.requiredType)) {
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

            case 0:
                return null;
            case 1:
                return list.get(0);
            default:
                throw new IncorrectResultSizeDataAccessException(1);
        }
    }
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

      for(int i=1; i<=colCount; i++){
        String colName = rsmd.getColumnLabel(i);
        resultMap.put(colName, rs.getObject(i));
      }
      if(rs.next()){
        throw new IncorrectResultSizeDataAccessException(1, -1);
      }
    }
    return resultMap;
  }
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

    if(rs.next()){
      for(int i=1; i<=colCount; i++){
        result[i-1] = rs.getObject(i);
      }
      if(rs.next()){
        throw new IncorrectResultSizeDataAccessException(1, -1);
      }
    }
    return result;
  }
View Full Code Here

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException

        assertThat((User)result, is(sameInstance(authUser)));
    }

    @Test(expected = UsernameNotFoundException.class)
    public void loadByUsername_invalid_exception() {
        expect(repository.getByUsername(USER_NAME)).andThrow(new IncorrectResultSizeDataAccessException(1));
        replay(repository);

        service.setAuthenticatedUser(USER_ID);
    }
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.