Package org.springframework.dao

Examples of org.springframework.dao.DataAccessException


    DatabaseMeta dbMeta = connectionModel.getDatabaseMeta();
    String url = null;
    try {
      url = dbMeta.getURL();
    } catch (KettleDatabaseException e) {
      throw new DataAccessException("DatabaseMeta problem", e) {
        private static final long serialVersionUID = -3457360074729938909L;
      };
    }
    // create the datasource
    DataSource ds = new SingleConnectionDataSource(dbMeta.getDriverClass(), url, dbMeta.getUsername(), dbMeta
View Full Code Here


        sqlExToUse = nestedSqlEx;
      }
    }

    // First, try custom translation from overridden method.
    DataAccessException dex = customTranslate(task, sql, sqlExToUse);
    if (dex != null) {
      return dex;
    }

    // Second, try subclass translation - if we are in Java 6 or later then we should have one of these.
    if (this.subclassTranslator != null) {
      dex = this.subclassTranslator.translate(task, sql, sqlExToUse);
      if (dex != null) {
        return dex;
      }
    }

    // Check SQLErrorCodes with corresponding error code, if available.
    if (this.sqlErrorCodes != null) {
      String errorCode = null;
      if (this.sqlErrorCodes.isUseSqlStateForTranslation()) {
        errorCode = sqlExToUse.getSQLState();
      }
      else {
        errorCode = Integer.toString(sqlExToUse.getErrorCode());
      }

      if (errorCode != null) {

        // Look for defined custom translations first.
        CustomSQLErrorCodesTranslation[] customTranslations = this.sqlErrorCodes.getCustomTranslations();
        if (customTranslations != null) {
          for (int i = 0; i < customTranslations.length; i++) {
            CustomSQLErrorCodesTranslation customTranslation = customTranslations[i];
            if (Arrays.binarySearch(customTranslation.getErrorCodes(), errorCode) >= 0) {
              if (customTranslation.getExceptionClass() != null) {
                DataAccessException customException = createCustomException(
                    task, sql, sqlExToUse, customTranslation.getExceptionClass());
                if (customException != null) {
                  logTranslation(task, sql, sqlExToUse, true);
                  return customException;
                }
View Full Code Here

      EntityTransaction tx = txObject.getEntityManagerHolder().getEntityManager().getTransaction();
      tx.commit();
    }
    catch (RollbackException ex) {
      if (ex.getCause() instanceof RuntimeException) {
        DataAccessException dex = getJpaDialect().translateExceptionIfPossible((RuntimeException) ex.getCause());
        if (dex != null) {
          throw dex;
        }
      }
      throw new TransactionSystemException("Could not commit JPA transaction", ex);
View Full Code Here

                for (int i = 1; i <= numCols; i++) {
                    cds.add(new DBColumnDesc(data, i));
                }
            }
        } catch (SQLException e) {
            DataAccessException errorVar = new SQLErrorCodeSQLExceptionTranslator().translate("Cannot get column List from result set\n" + e.getMessage(), "", e );
            ErrorMgr.addError(errorVar);
            throw errorVar;
            // PM:16/07/2008
        } catch (NullPointerException e){
          String msg = (e.getMessage() == null) ? e.getClass().getName() : e.getMessage();
View Full Code Here

      if (resultSet == null) {
        try {
          setter.setParameterValue(this.statement, pColOrdinal, SqlTypeValue.TYPE_UNKNOWN, null, pValue);
        }
        catch (SQLException e) {
          DataAccessException errorVar = new SQLErrorCodeSQLExceptionTranslator().translate("DBDataSet.setValue(" + pColOrdinal +"," + pValue + ")", "", e );
          ErrorMgr.addError(errorVar);
          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
View Full Code Here

      if (resultSet == null) {
        try {
          this.statement.setInt(pColOrdinal, pValue);
        }
        catch (SQLException e) {
          DataAccessException errorVar = new SQLErrorCodeSQLExceptionTranslator().translate("DBDataSet.setValue(" + pColOrdinal +"," + pValue + ")", "", e );
          ErrorMgr.addError(errorVar);
          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
View Full Code Here

      if (resultSet == null) {
        try {
          this.statement.setFloat(pColOrdinal, pValue);
        }
        catch (SQLException e) {
          DataAccessException errorVar = new SQLErrorCodeSQLExceptionTranslator().translate("DBDataSet.setValue(" + pColOrdinal +"," + pValue + ")", "", e );
          ErrorMgr.addError(errorVar);
          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
View Full Code Here

      if (resultSet == null) {
        try {
          this.statement.setDouble(pColOrdinal, pValue);
        }
        catch (SQLException e) {
          DataAccessException errorVar = new SQLErrorCodeSQLExceptionTranslator().translate("DBDataSet.setValue(" + pColOrdinal +"," + pValue + ")", "", e );
          ErrorMgr.addError(errorVar);
          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
View Full Code Here

      if (resultSet == null) {
        try {
          this.statement.setLong(pColOrdinal, pValue);
        }
        catch (SQLException e) {
          DataAccessException errorVar = new SQLErrorCodeSQLExceptionTranslator().translate("DBDataSet.setValue(" + pColOrdinal +"," + pValue + ")", "", e );
          ErrorMgr.addError(errorVar);
          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
View Full Code Here

      if (resultSet == null) {
        try {
          this.statement.setBoolean(pColOrdinal, pValue);
        }
        catch (SQLException e) {
          DataAccessException errorVar = new SQLErrorCodeSQLExceptionTranslator().translate("DBDataSet.setValue(" + pColOrdinal +"," + pValue + ")", "", e );
          ErrorMgr.addError(errorVar);
          throw errorVar;
        }
      } else {
        // AD:20/11/2008: Allow for CachedRowSet to be updated if the DBDataSet has already been populated.
View Full Code Here

TOP

Related Classes of org.springframework.dao.DataAccessException

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.