Package org.springframework.dao

Examples of org.springframework.dao.IncorrectResultSizeDataAccessException


            LdapUtils.closeEnumeration(resultsEnum);
            logger.info("Ignoring PartialResultException");
        }

        if (results.size() == 0) {
            throw new IncorrectResultSizeDataAccessException(1, 0);
        }

        if (results.size() > 1) {
            throw new IncorrectResultSizeDataAccessException(1, results.size());
        }

        return results.iterator().next();
    }
View Full Code Here


    public boolean userExists(String username) {
        List<String> users = getJdbcTemplate().queryForList(userExistsSql, new String[] {username}, String.class);

        if (users.size() > 1) {
            throw new IncorrectResultSizeDataAccessException("More than one user found with name '" + username + "'", 1);
        }

        return users.size() == 1;
    }
View Full Code Here

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

        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

    }
    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);
    }
    if (ex instanceof StaleStateException) {
View Full Code Here

        final ParameterHolder qqh_title3 = new ParameterHolder(title3);
        final ParameterHolder qqh_totalValue = new ParameterHolder(totalValue);
        RowCountCallbackHandler qq_RowCounter = new RowCountCallbackHandler() {
            protected void processRow(ResultSet pResultSet, int pRow) throws SQLException {
                if (pRow >= 1) {
                    throw new IncorrectResultSizeDataAccessException(1, pRow+1);
                }
                ResultSetHelper helper = new ResultSetHelper(pResultSet);
                qqh_title1.setObject(helper.getString(1));
                qqh_numCustomers.setInt(helper.getInt(2));
                qqh_title2.setObject(helper.getTextData(3));
View Full Code Here

        final ParameterHolder qqh_title3 = new ParameterHolder(title3);
        final ParameterHolder qqh_totalValue = new ParameterHolder(totalValue);
        RowCountCallbackHandler qq_RowCounter = new RowCountCallbackHandler() {
            protected void processRow(ResultSet pResultSet, int pRow) throws SQLException {
                if (pRow >= 1) {
                    throw new IncorrectResultSizeDataAccessException(1, pRow+1);
                }
                ResultSetHelper helper = new ResultSetHelper(pResultSet);
                qqh_title1.setObject(helper.getString(1));
                qqh_numCustomers.setInt(helper.getInt(2));
                qqh_title2.setObject(helper.getTextData(3));
View Full Code Here

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

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

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

TOP

Related Classes of org.springframework.dao.IncorrectResultSizeDataAccessException

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.