예제 #1
0
 @Override
 public void delete(PessoaFisica t) {
   // TODO Auto-generated method stub
   try {
     PreparedStatement p =
         JDBCUtil.getConnection().prepareStatement("delete from tb_pessoa_fisica where id = ?");
     p.setLong(1, t.getId());
     p.executeUpdate();
   } catch (Exception e) {
     e.printStackTrace();
   } finally {
     JDBCUtil.closeConnection();
   }
 }
예제 #2
0
  @Override
  public void update(PessoaFisica t) {
    try {
      PreparedStatement p =
          JDBCUtil.getConnection()
              .prepareStatement(
                  "update tb_pessoa_fisica set nome = ?, endereco = ?, telefone = ?, cpf = ?, email = ?, data_nascimento = ?, sexo = ? "
                      + "where id = ?");

      p.setString(1, t.getNome());
      p.setString(2, t.getEndereco());
      p.setString(3, t.getTelefone());
      p.setString(4, t.getCpf());
      p.setString(5, t.getEmail());
      p.setString(6, df.format(t.getDataNascimento()));
      p.setString(7, t.getSexo());
      p.setLong(8, t.getId());
      p.executeUpdate();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      JDBCUtil.closeConnection();
    }
  }
예제 #3
0
  @Override
  public void insert(PessoaFisica t) {
    try {
      PreparedStatement p =
          JDBCUtil.getConnection()
              .prepareStatement(
                  "insert into tb_pessoa_fisica (nome, endereco, telefone, cpf, email, data_nascimento, sexo) "
                      + "values (?,?,?,?,?,?,?)");

      p.setString(1, t.getNome());
      p.setString(2, t.getEndereco());
      p.setString(3, t.getTelefone());
      p.setString(4, t.getCpf());
      p.setString(5, t.getEmail());
      p.setString(6, df.format(t.getDataNascimento()));
      p.setString(7, t.getSexo());
      p.executeUpdate();
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      JDBCUtil.closeConnection();
    }
  }