Package org.springframework.dao

Examples of org.springframework.dao.DataAccessResourceFailureException


            }
          }
        }
      }
      catch (Throwable ex) {
        throw new DataAccessResourceFailureException(
            "Could not register synchronization with JTA TransactionManager", ex);
      }
    }
  }
View Full Code Here


          return sessionFactory.openSession();
        }
      }
    }
    catch (HibernateException ex) {
      throw new DataAccessResourceFailureException("Could not open Hibernate Session", ex);
    }
  }
View Full Code Here

   * @see HibernateAccessor#convertHibernateAccessException
   * @see HibernateTransactionManager#convertHibernateAccessException
   */
  public static DataAccessException convertHibernateAccessException(HibernateException ex) {
    if (ex instanceof JDBCConnectionException) {
      return new DataAccessResourceFailureException(ex.getMessage(), ex);
    }
    if (ex instanceof SQLGrammarException) {
      return new InvalidDataAccessResourceUsageException(ex.getMessage(), ex);
    }
    if (ex instanceof DataException) {
View Full Code Here

      if (logger.isInfoEnabled()) {
        logger.info("Done executing SQL scriptBuilder from " + resource + " in " + elapsedTime + " ms.");
      }
    }
    catch (IOException ex) {
      throw new DataAccessResourceFailureException("Failed to open SQL script from " + resource, ex);
    }
    finally {
      try {
        if (reader != null) {
          reader.close();
View Full Code Here

        }
        if (tmd == null) {
          tmd = tableMeta.get("DBO");
        }
        if (tmd == null) {
          throw new DataAccessResourceFailureException("Unable to locate table meta data for '" +
              tableName + "' in the default schema");
        }
      }
      else {
        tmd = tableMeta.get(schemaName.toUpperCase());
        if (tmd == null) {
          throw new DataAccessResourceFailureException("Unable to locate table meta data for '" +
              tableName + "' in the '" + schemaName + "' schema");
        }
      }

      processTableColumns(databaseMetaData, tmd);
View Full Code Here

    }
    String encryptedPassword = null;
    try {
      encryptedPassword = WikiBase.getDataHandler().lookupWikiUserEncryptedPassword(username);
    } catch (org.jamwiki.DataAccessException e) {
      throw new DataAccessResourceFailureException("Unable to retrieve authorities for user: " + username, e);
    }
    if (encryptedPassword == null) {
      throw new UsernameNotFoundException("Failure retrieving user information for " + username);
    }
    Collection<GrantedAuthority> authorities = this.retrieveUserAuthorities(username);
View Full Code Here

          for (Role role : roles) {
            results.add((RoleImpl)role);
          }
        }
      } catch (org.jamwiki.DataAccessException e) {
        throw new DataAccessResourceFailureException("Unable to retrieve authorities for user: " + username, e);
      }
    }
    return results;
  }
View Full Code Here

        for (int i = 0; i < getCacheSize(); i++) {
          stmt.executeUpdate("insert into " + getIncrementerName() + " values()");
          ResultSet rs = stmt.executeQuery("select @@identity");
          try {
            if (!rs.next()) {
              throw new DataAccessResourceFailureException("@@identity failed after executing an update");
            }
            this.valueCache[i] = rs.getLong(1);
          }
          finally {
            JdbcUtils.closeResultSet(rs);
          }
        }
        long maxValue = this.valueCache[(this.valueCache.length - 1)];
        stmt.executeUpdate("delete from " + getIncrementerName() + " where " + getColumnName() + " < " + maxValue);
      }
      catch (SQLException ex) {
        throw new DataAccessResourceFailureException("Could not increment identity", ex);
      }
      finally {
        JdbcUtils.closeStatement(stmt);
        DataSourceUtils.releaseConnection(con, getDataSource());
      }
View Full Code Here

        for (int i = 0; i < getCacheSize(); i++) {
          stmt.executeUpdate("insert into " + getIncrementerName() + " default values");
          ResultSet rs = stmt.executeQuery("select @@identity");
          try {
            if (!rs.next()) {
              throw new DataAccessResourceFailureException("@@identity failed after executing an update");
            }
            this.valueCache[i] = rs.getLong(1);
          }
          finally {
            JdbcUtils.closeResultSet(rs);
          }
        }
        long maxValue = this.valueCache[(this.valueCache.length - 1)];
        stmt.executeUpdate("delete from " + getIncrementerName() + " where " + getColumnName() + " < " + maxValue);
      }
      catch (SQLException ex) {
        throw new DataAccessResourceFailureException("Could not increment identity", ex);
      }
      finally {
        JdbcUtils.closeStatement(stmt);
        DataSourceUtils.releaseConnection(con, getDataSource());
      }
View Full Code Here

        for (int i = 0; i < getCacheSize(); i++) {
          stmt.executeUpdate("insert into " + getIncrementerName() + " values(null)");
          ResultSet rs = stmt.executeQuery("select max(identity()) from " + getIncrementerName());
          try {
            if (!rs.next()) {
              throw new DataAccessResourceFailureException("identity() failed after executing an update");
            }
            this.valueCache[i] = rs.getLong(1);
          }
          finally {
            JdbcUtils.closeResultSet(rs);
          }
        }
        long maxValue = this.valueCache[(this.valueCache.length - 1)];
        stmt.executeUpdate("delete from " + getIncrementerName() + " where " + getColumnName() + " < " + maxValue);
      }
      catch (SQLException ex) {
        throw new DataAccessResourceFailureException("Could not obtain identity()", ex);
      }
      finally {
        JdbcUtils.closeStatement(stmt);
        DataSourceUtils.releaseConnection(con, getDataSource());
      }
View Full Code Here

TOP

Related Classes of org.springframework.dao.DataAccessResourceFailureException

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.