Package lib.exceptions

Examples of lib.exceptions.SQLPersistenceMechanismException


    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
    } finally {
      try {
        mp.releaseCommunicationChannel();
      } catch (PersistenceMechanismException e) {
        throw new RepositoryException(e.getMessage());
View Full Code Here


      stmt.close();

    } catch (PersistenceMechanismException e) {
      throw new RepositoryException("PersistenceMechanismException: " + e.getMessage());
    } catch (SQLException e) {
      throw new SQLPersistenceMechanismException("SQLException: " + e.getMessage(),sql);
    } finally {
      try {
        mp.releaseCommunicationChannel();
      } catch (PersistenceMechanismException e) {
        throw new RepositoryException("PersistenceMechanismException: " + e.getMessage());
View Full Code Here

        resultSet.close();
        stmt.close();

      } catch (SQLException e) {
        throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD, consulta);
      }

      // Consulta na tabela ao c�digo gerado pelo trecho anterior.
      // Caso o c�digo j� esteja em uso uma exce��o � levantada.
      String sql = null;
      try {
        stmt = (Statement) mp.getCommunicationChannel();
        sql = "SELECT * FROM scbs_endereco WHERE codigo = '" + end.getId() + "'";
        resultSet = stmt.executeQuery(sql);

        if (resultSet.next()) {
          throw new ObjectAlreadyInsertedException(ExceptionMessages.EXC_JA_EXISTE);
        }
        resultSet.close();
        stmt.close();
      } catch (SQLException e) {
        throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD, sql);
      }

      // Essa �ltima etapa da inser��o insere de fato os valores
      // recebidos no objeto do par�metro com c�digo e
      // identificador devidamente alterados
      try {
        sql = "INSERT INTO scbs_endereco VALUES(";

        //sql += end.getId() + ",";
        sql += "'" + end.getId() + "',";
        sql += "'" + end.getStreet() + "',";
        sql += "'" + end.getComplement() + "',";
        sql += "'" + end.getZip() + "',";
        sql += "'" + end.getState() + "',";
        sql += "'" + end.getPhone() + "',";
        sql += "'" + end.getCity() + "',";
        sql += "'" + end.getNeighbourhood() + "')";

        stmt = (Statement) this.mp.getCommunicationChannel();
        stmt.executeUpdate(sql);
        stmt.close();

      } catch (SQLException e) {
        throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD, sql);
      }
    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_INCLUSAO);
    }
   
View Full Code Here

      stmt.close();

    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
    }

    return end;
  }
View Full Code Here

            resultSet.close();
            stmt.close();           
        } catch (PersistenceMechanismException e) {
            throw new RepositoryException(e.getMessage());
        } catch (SQLException e) {
            throw new SQLPersistenceMechanismException(e.getMessage(),sql);
        }
        return response;
  }
View Full Code Here

    } catch (PersistenceMechanismException e) {
      e.printStackTrace();
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
    }
    return new ConcreteIterator(listatd);
  }
View Full Code Here

                sql += td.getManifestation() + "','";
                sql += td.getDuration() + "')";              
                stmt.executeUpdate(sql);
                stmt.close();
            } catch (SQLException e) {
                throw new SQLPersistenceMechanismException(e.getMessage(),sql);
            } catch (PersistenceMechanismException e) {
                throw new RepositoryException(e.getMessage());
            } finally {
                try {
                    mp.releaseCommunicationChannel();
View Full Code Here

      td.setId(codigo);

    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(e.getMessage());
    } catch (SQLException e) {
      throw new SQLPersistenceMechanismException(e.getMessage(),sql);
    } finally {
      try {
        mp.releaseCommunicationChannel();
      } catch (PersistenceMechanismException e) {
        throw new RepositoryException(e.getMessage());
View Full Code Here

    } catch (PersistenceMechanismException e) {
      throw new RepositoryException(ExceptionMessages.EXC_FALHA_BD);
    } catch (SQLException e) {
      e.printStackTrace();
      throw new SQLPersistenceMechanismException(ExceptionMessages.EXC_FALHA_BD,sql);
    }
   
    return td;
  }
View Full Code Here

  public synchronized PreparedStatement getPreparedStatement(String sql)
      throws RepositoryException {
    try {
      return getCommunicationChannel(false).prepareStatement(sql);
    } catch (SQLException ex) {
      throw new SQLPersistenceMechanismException("SQLException: " + ex.getMessage(),sql);
    }
  }
View Full Code Here

TOP

Related Classes of lib.exceptions.SQLPersistenceMechanismException

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.