Package org.springframework.dao

Examples of org.springframework.dao.DataAccessException


      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

      if (resultSet == null) {
        try {
          this.statement.setShort(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.setString(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

   */
  public static RuntimeException translateIfNecessary(
      RuntimeException rawException, PersistenceExceptionTranslator pet) {

    Assert.notNull(pet, "PersistenceExceptionTranslator must not be null");
    DataAccessException dex = pet.translateExceptionIfPossible(rawException);
    return (dex != null ? dex : rawException);
  }
View Full Code Here

        this.delegates.toArray(new PersistenceExceptionTranslator[this.delegates.size()]);
  }


  public DataAccessException translateExceptionIfPossible(RuntimeException ex) {
    DataAccessException translatedDex = null;
    for (Iterator it = this.delegates.iterator(); translatedDex == null && it.hasNext(); ) {
      PersistenceExceptionTranslator pet = (PersistenceExceptionTranslator) it.next();
      translatedDex = pet.translateExceptionIfPossible(ex);
    }
    return translatedDex;
View Full Code Here

        sqlEx = nestedSqlEx;
      }
    }

    // First, try custom translation from overridden method.
    DataAccessException dex = customTranslate(task, sql, sqlEx);
    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 = sqlEx.getSQLState();
      }
      else {
        errorCode = Integer.toString(sqlEx.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, sqlEx, customTranslation.getExceptionClass());
                if (customException != null) {
                  logTranslation(task, sql, sqlEx, true);
                  return customException;
                }
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.