Package org.springframework.dao

Examples of org.springframework.dao.InvalidDataAccessApiUsageException


          parameter = declaredParameters.get(this.getFunctionReturnName());
          if (parameter == null && this.getOutParameterNames().size() > 0) {
            parameter = declaredParameters.get(this.getOutParameterNames().get(0).toLowerCase());
          }
          if (parameter == null) {
            throw new InvalidDataAccessApiUsageException(
                "Unable to locate declared parameter for function return value - " +
                    " add an SqlOutParameter with name \"" + getFunctionReturnName() +"\"");
          }
          else {
            this.setFunctionReturnName(parameter.getName());
View Full Code Here


   * been correctly initialized, for example if no DataSource has been provided
   */
  public final void compile() throws InvalidDataAccessApiUsageException {
    if (!isCompiled()) {
      if (getProcedureName() == null) {
        throw new InvalidDataAccessApiUsageException("Procedure or Function name is required");
      }

      try {
        this.jdbcTemplate.afterPropertiesSet();
      }
      catch (IllegalArgumentException ex) {
        throw new InvalidDataAccessApiUsageException(ex.getMessage());
      }

      compileInternal();
      this.compiled = true;

View Full Code Here

  }

  public List executeFind(JpaCallback<?> action) throws DataAccessException {
    Object result = execute(action, isExposeNativeEntityManager());
    if (!(result instanceof List)) {
      throw new InvalidDataAccessApiUsageException(
          "Result object returned from JpaCallback isn't a List: [" + result + "]");
    }
    return (List) result;
  }
View Full Code Here

   */
  public static DataAccessException convertJpaAccessExceptionIfPossible(RuntimeException ex) {
    // Following the JPA specification, a persistence provider can also
    // throw these two exceptions, besides PersistenceException.
    if (ex instanceof IllegalStateException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof IllegalArgumentException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }

    // 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, ex);
    }
    if (ex instanceof OptimisticLockException) {
      return new JpaOptimisticLockingFailureException((OptimisticLockException) ex);
    }
    if (ex instanceof EntityExistsException) {
      return new DataIntegrityViolationException(ex.getMessage(), ex);
    }
    if (ex instanceof TransactionRequiredException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }

    // If we have another kind of PersistenceException, throw it.
    if (ex instanceof PersistenceException) {
      return new JpaSystemException((PersistenceException) ex);
View Full Code Here

    }
    if (ex instanceof PropertyValueException) {
      return new DataIntegrityViolationException(ex.getMessage(), ex);
    }
    if (ex instanceof PersistentObjectException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof TransientObjectException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof ObjectDeletedException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof QueryException) {
      return new HibernateQueryException((QueryException) ex);
    }
    if (ex instanceof UnresolvableObjectException) {
View Full Code Here

    }
    if (ex instanceof PropertyValueException) {
      return new DataIntegrityViolationException(ex.getMessage(), ex);
    }
    if (ex instanceof PersistentObjectException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof TransientObjectException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof ObjectDeletedException) {
      return new InvalidDataAccessApiUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof QueryException) {
      return new HibernateQueryException((QueryException) ex);
    }
    if (ex instanceof UnresolvableObjectException) {
View Full Code Here

            this.currSql = sql[i];
            if (!stmt.execute(sql[i])) {
              rowsAffected[i] = stmt.getUpdateCount();
            }
            else {
              throw new InvalidDataAccessApiUsageException("Invalid batch SQL statement: " + sql[i]);
            }
          }
        }
        return rowsAffected;
      }
View Full Code Here

            this.currSql = sql[i];
            if (!stmt.execute(sql[i])) {
              rowsAffected[i] = stmt.getUpdateCount();
            }
            else {
              throw new InvalidDataAccessApiUsageException("Invalid batch SQL statement: " + sql[i]);
            }
          }
        }
        return rowsAffected;
      }
View Full Code Here

  }

  public Collection executeFind(JdoCallback<?> action) throws DataAccessException {
    Object result = execute(action, isExposeNativePersistenceManager());
    if (result != null && !(result instanceof Collection)) {
      throw new InvalidDataAccessApiUsageException(
          "Result object returned from JdoCallback isn't a Collection: [" + result + "]");
    }
    return (Collection) result;
  }
View Full Code Here

            this.clobClass, this.clobClass.getField(MODE_READWRITE_FIELD_NAME).getInt(null));
        this.modeReadOnlyConstants.put(
            this.clobClass, this.clobClass.getField(MODE_READONLY_FIELD_NAME).getInt(null));
      }
      catch (Exception ex) {
        throw new InvalidDataAccessApiUsageException(
            "Couldn't initialize OracleLobHandler because Oracle driver classes are not available. " +
            "Note that OracleLobHandler requires Oracle JDBC driver 9i or higher!", ex);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.dao.InvalidDataAccessApiUsageException

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.