Package org.springframework.dao

Examples of org.springframework.dao.InvalidDataAccessApiUsageException


          in = paramValue.getValue();
          declaredParameter = paramValue;
        }
        else {
          if (declaredParameters.size() <= i) {
            throw new InvalidDataAccessApiUsageException(
                "SQL [" + sql + "]: unable to access parameter number " + (i + 1) +
                " given only " + declaredParameters.size() + " parameters");

          }
          declaredParameter = (SqlParameter) declaredParameters.get(i);
View Full Code Here


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

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

      compileInternal();
      this.compiled = true;

View Full Code Here

   * Method to check whether we are allowd to make any configuration changes at this time.  If the class has been
   * compiled, then no further changes to the configuration are allowed.
   */
  protected void checkIfConfigurationModificationIsAllowed() {
    if (isCompiled()) {
      throw new InvalidDataAccessApiUsageException("Configuration can't be altered once the class has been compiled or used.");
    }
  }
View Full Code Here

      if (!this.tableMetaDataContext.isGetGeneratedKeysSimulated()) {
        throw new InvalidDataAccessResourceUsageException(
            "The getGeneratedKeys feature is not supported by this database");
      }
      if (getGeneratedKeyNames().length < 1) {
        throw new InvalidDataAccessApiUsageException("Generated Key Name(s) not specificed. " +
            "Using the generated keys features requires specifying the name(s) of the generated column(s)");
      }
      if (getGeneratedKeyNames().length > 1) {
        throw new InvalidDataAccessApiUsageException(
            "Current database only supports retreiving the key for a single column. There are " +
            getGeneratedKeyNames().length  + " columns specified: " + Arrays.asList(getGeneratedKeyNames()));
      }
      // This is a hack to be able to get the generated key from a database that doesn't support
      // get generated keys feature.  HSQL is one, PostgreSQL is another.  Postgres uses a RETURNING
View Full Code Here

   * @return PreparedStatement to use
   * @throws SQLException
   */
  private PreparedStatement prepareStatementForGeneratedKeys(Connection con) throws SQLException {
    if (getGeneratedKeyNames().length < 1) {
      throw new InvalidDataAccessApiUsageException("Generated Key Name(s) not specificed. " +
          "Using the generated keys features requires specifying the name(s) of the generated column(s)");
    }
    PreparedStatement ps;
    if (this.tableMetaDataContext.isGeneratedKeysColumnNameArraySupported()) {
      if (logger.isDebugEnabled()) {
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

   * @param argTypes the corresponding SQL types of the arguments
   */
  public ArgTypePreparedStatementSetter(Object[] args, int[] argTypes) {
    if ((args != null && argTypes == null) || (args == null && argTypes != null) ||
        (args != null && args.length != argTypes.length)) {
      throw new InvalidDataAccessApiUsageException("args and argTypes parameters must match");
    }
    this.args = args;
    this.argTypes = argTypes;
  }
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

  }

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

  }

  public List executeFind(HibernateCallback action) throws DataAccessException {
    Object result = doExecute(action, false, false);
    if (result != null && !(result instanceof List)) {
      throw new InvalidDataAccessApiUsageException(
          "Result object returned from HibernateCallback isn't a List: [" + result + "]");
    }
    return (List) result;
  }
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.