Package org.springframework.dao

Examples of org.springframework.dao.InvalidDataAccessApiUsageException


        if (this.prevaylerTemplate != null) {
            try {
                this.prevaylerTemplate.afterPropertiesSet();
            }
            catch (Exception ex) {
                throw new InvalidDataAccessApiUsageException("Invalid prevayler template configuration!");
            }
        }
        else throw new IllegalStateException("No prevayler template set!");
    }
View Full Code Here


    }
    if (ex instanceof MergeException) {
      return new DataIntegrityViolationException("Merge failed", ex);
    }
    if (ex instanceof NamespaceException) {
      return new InvalidDataAccessApiUsageException("Namespace not registred", ex);
    }
    if (ex instanceof NoSuchNodeTypeException) {
      return new InvalidDataAccessApiUsageException("No such node type", ex);
    }
    if (ex instanceof NoSuchWorkspaceException) {
      return new DataAccessResourceFailureException("Workspace not found", ex);
    }
    if (ex instanceof PathNotFoundException) {
      return new DataRetrievalFailureException("Path not found", ex);
    }
    if (ex instanceof ReferentialIntegrityException) {
      return new DataIntegrityViolationException("Referential integrity violated", ex);
    }
    if (ex instanceof UnsupportedRepositoryOperationException) {
      return new InvalidDataAccessApiUsageException("Unsupported operation", ex);
    }
    if (ex instanceof ValueFormatException) {
      return new InvalidDataAccessApiUsageException("Incorrect value format", ex);
    }
    if (ex instanceof VersionException) {
      return new DataIntegrityViolationException("Invalid version graph operation", ex);
    }
    // fallback
View Full Code Here

        return pluralExceptions;
    }

    public void setTableNameToUse(String tableNameToUse) {
        if (overrideTableName)
            throw new InvalidDataAccessApiUsageException("Table name can only be overriden once");
        this.tableNameToUse = tableNameToUse;
        this.overrideTableName = true;
    }
View Full Code Here

        return tableNameToUse;
    }

    public void setVersionColumnToUse(String versionColumnToUse) {
        if (overrideVersionColumn)
            throw new InvalidDataAccessApiUsageException("Version column can only be overriden once");
        this.versionColumnToUse = versionColumnToUse;
        this.overrideVersionColumn = true;
    }
View Full Code Here

        rowMapper = new ActiveRowMapper(mappedClass, persistentObject);
    }

    public Object find(Object id) {
        if (persistentObject == null)
            throw new InvalidDataAccessApiUsageException("Persistent class not specified");
        String sql = "select * from " + tableNameToUse + " where id = ?";
        List l = getJdbcTemplate().query(sql, new Object[] {id}, rowMapper);
        if (l.size() > 0)
            return l.get(0);
        else
View Full Code Here

            return null;
    }

    public List findAll() {
        if (persistentObject == null)
            throw new InvalidDataAccessApiUsageException("Persistent class not specified");
        String sql = "select * from " + tableNameToUse;
        return getJdbcTemplate().query(sql, rowMapper);
    }
View Full Code Here

        return getJdbcTemplate().query(sql, rowMapper);
    }

    protected List findByWhereClause(String whereClause, Object[] arguments) {
        if (persistentObject == null)
            throw new InvalidDataAccessApiUsageException("Persistent class not specified");
        String sql = "select * from " + tableNameToUse + " where " + whereClause;
        return getJdbcTemplate().query(sql, arguments, rowMapper);
    }
View Full Code Here

        return getJdbcTemplate().query(sql, arguments, rowMapper);
    }

    public List findBy(String field, int operator, Object argument) {
        if (persistentObject == null)
            throw new InvalidDataAccessApiUsageException("Persistent class not specified");
        StringBuffer whereClause = new StringBuffer();
        StringBuffer endClause = new StringBuffer();
        switch (operator) {
            case Operators.EQUALS:
                whereClause.append(ActiveMapperUtils.underscoreName(field)).append(" = ");
View Full Code Here

                                    }
                                }
                                columnValues.add(new PersistentValue(pf.getColumnName(), pf.getSqlType(), newVersionValue));
                            }
                            else {
                                throw new InvalidDataAccessApiUsageException("Invalid type for version column.  Must be of type Number.");
                            }
                        }
                        else {
                            columnValues.add(new PersistentValue(pf.getColumnName(), pf.getSqlType(), r));
                        }
                    }

                } catch (NoSuchMethodException e1) {
                    throw new DataAccessResourceFailureException(new StringBuffer().append("Failed to map field ").append(pf.getFieldName()).append(".").toString(), e1);
                } catch (IllegalAccessException e1) {
                    throw new DataAccessResourceFailureException(new StringBuffer().append("Failed to map field ").append(pf.getFieldName()).append(".").toString(), e1);
                } catch (InvocationTargetException e1) {
                    throw new DataAccessResourceFailureException(new StringBuffer().append("Failed to map field ").append(pf.getFieldName()).append(".").toString(), e1);
                }
            }
            else {
                unmappedFields.put(pf.getFieldName(), pf);
            }
        }
        List additionalColumnValues = completeMappingOnSave(o, mappedFields, unmappedFields);
        for (Iterator iter = additionalColumnValues.iterator(); iter.hasNext(); ) {
            Object colVal = iter.next();
            if (colVal instanceof PersistentValue) {
                if (((PersistentValue)colVal).isIdValue())
                    idValues.add(colVal);
                else
                    columnValues.add(colVal);
            }
            else {
                throw new InvalidDataAccessApiUsageException("Invalid type returned for additional columns.  Must be of type PersistentValue.");
            }
        }
        if (persistentObject.isDependentObject()) {
            StringBuffer cntSql = new StringBuffer();
            cntSql.append("select count(*) from ").append(tableNameToUse);
View Full Code Here

  }

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