public ArrayList<PublicacaoBean> retornaPublicacoes(UsuarioBean objUsuario)
      throws SSDAOException {

    ArrayList<PublicacaoBean> listaPublicacao = new ArrayList<PublicacaoBean>();

    PreparedStatement ps = null;
    Connection conn = null;
    String SQL = "";
    int cont = 0;
    try {

      SQL =
          "SELECT * FROM ID_PUBLICADOR "
              + "INNER JOIN PUBLICATION ON ID_PUBLICADOR.ID=PUBLICATION.ID "
              + "WHERE ID_PUBLICADOR.ID_PUBLICADOR=?";

      conn = this.conn;
      ps = conn.prepareStatement(SQL);
      ps.clearParameters();
      ps.setInt(1, objUsuario.getIdusuario());
      ResultSet rs = ps.executeQuery();

      while (rs.next()) {
        PublicacaoBean pb = new PublicacaoBean();
        pb.setID(rs.getInt("ID"));
        pb.setTitulo(rs.getString("TITLE"));
        pb.setLocal(rs.getString("BOOKTITLE"));
        pb.setAno(rs.getInt("YEAR"));
        pb.setAutor(retornaAutores(pb.getID()));
        pb.setPaginas(retornaPaginas(pb.getID()));
        listaPublicacao.add(cont, pb);
        cont++;
      }

    } catch (SQLException e) {
      throw new SSDAOException("Erro ao consultar dados " + e);
    } finally {
      ConnectionSSFactory.closeConnection(conn, ps);
    }
    return listaPublicacao;
  }
  public void incluir(PublicacaoBean objPublicacao, UsuarioBean objUsuarioBean)
      throws SSDAOException {

    PreparedStatement ps = null;
    PreparedStatement ps2 = null;

    Connection conn = null;
    if (objPublicacao == null) {
      throw new SSDAOException("O valor passado nao pode ser nulo");
    }
    try {
      int ID = objPublicacao.getID();
      String titulo = objPublicacao.getTitulo();
      String[] autor = objPublicacao.getAutor();
      String local = objPublicacao.getLocal();
      String pagina = objPublicacao.getPaginas();
      int ano = objPublicacao.getAno();

      String SQL = "INSERT INTO PUBLICATION(ID,BOOKTITLE,TITLE,YEAR) " + "VALUES (?,?,?,?) ";
      conn = this.conn;
      ps = conn.prepareStatement(SQL);
      ps.clearParameters();
      ps.setInt(1, ID);
      ps.setString(2, local);
      ps.setString(3, titulo);
      ps.setInt(4, ano);
      ps.executeUpdate();

      SQL = "INSERT INTO ID_AUTHOR (ID,AUTHOR) VALUES (?,?)";
      String SQL2 = "INSERT INTO T_AUTHOR (AUTHOR) VALUES (?)";
      ps = conn.prepareStatement(SQL);
      ps2 = conn.prepareStatement(SQL2);
      for (int i = 0; i < autor.length; i++) {
        if (!verificarExistencia(TBAUTHOR, autor[i])) {
          ps2.clearParameters();
          ps2.setString(1, autor[i]);
          ps2.executeUpdate();
        }
        ps.clearParameters();
        ps.setInt(1, ID);
        ps.setString(2, autor[i]);
        ps.executeUpdate();
      }

      SQL = "INSERT INTO ID_PAGES (ID,PAGES) VALUES (?,?)";
      SQL2 = "INSERT INTO T_PAGES (PAGES) VALUES (?)";
      ps = conn.prepareStatement(SQL);
      if (!verificarExistencia(TBPAGES, pagina)) {
        ps2 = conn.prepareStatement(SQL2);
        ps2.clearParameters();
        ps2.setString(1, pagina);
        ps2.executeUpdate();
      }
      ps.clearParameters();
      ps.setInt(1, ID);
      ps.setString(2, pagina);
      ps.executeUpdate();

      SQL = "INSERT INTO ID_PUBLICADOR(ID,ID_PUBLICADOR) VALUES(?,?)";
      ps = conn.prepareStatement(SQL);
      ps.setInt(1, ID);
      ps.setInt(2, objUsuarioBean.getIdusuario());
      ps.executeUpdate();

    } catch (SQLException e) {
      throw new SSDAOException("Erro ao inserir dados " + e);
    } finally {
      ConnectionSSFactory.closeConnection(conn, ps);
    }
  }