Boa Noite.... pedi uma ajuda ontem sobre JTable mas não consegui resolver por muita falta de experiencia o.O
olha so tenhu 4 pacortes... dto, ctr, dao e view....
no dao eu tenhu a classe conexao e a FuncionarioDAO... segue a classe Funcionario DAO
package br.com.siscom.dao;
import br.com.siscom.dto.FuncionarioDTO;
import java.sql.*;
public class FuncionarioDAO {
ResultSet rs = null;
public boolean inserirFuncionario(FuncionarioDTO funcionarioDTO) {
try {
Conexao.ConnectDB();
Statement stmt = Conexao.con.createStatement();
String Sql = "Insert into Funcionario(nome, cpf, rg, ctps, datanascimento, "
+ "sexo, dataadmissao, datademissao, cargo, endereco, complemento, "
+ "bairro, cidade, uf, cep, telres, telcel, email, comissao, usuario, "
+ "senha, situacao, codfunc) values( "
+ "'"
+ funcionarioDTO.getNome()
+ "', "
+ "'"
+ funcionarioDTO.getCpf()
+ "', "
+ "'"
+ funcionarioDTO.getRg()
+ "', "
+ "'"
+ funcionarioDTO.getCtps()
+ "', "
+ "'"
+ funcionarioDTO.getDatanascimento()
+ "', "
+ "'"
+ funcionarioDTO.getSexo()
+ "', "
+ "'"
+ funcionarioDTO.getDataadmissao()
+ "', "
+ "'"
+ funcionarioDTO.getDatademissao()
+ "', "
+ "'"
+ funcionarioDTO.getCargo()
+ "', "
+ "'"
+ funcionarioDTO.getEndereco()
+ "', "
+ "'"
+ funcionarioDTO.getComplemento()
+ "', "
+ "'"
+ funcionarioDTO.getBairro()
+ "', "
+ "'"
+ funcionarioDTO.getCidade()
+ "', "
+ "'"
+ funcionarioDTO.getUf()
+ "', "
+ "'"
+ funcionarioDTO.getCep()
+ "', "
+ "'"
+ funcionarioDTO.getTelres()
+ "', "
+ "'"
+ funcionarioDTO.getTelcel()
+ "', "
+ "'"
+ funcionarioDTO.getEmail()
+ "', "
+ "'"
+ funcionarioDTO.getComissao()
+ "', "
+ "'"
+ funcionarioDTO.getUsuario()
+ "', "
+ "'"
+ funcionarioDTO.getSenha()
+ "', "
+ "'"
+ funcionarioDTO.getSituacao()
+ "', "
+ "'"
+ funcionarioDTO.getCodfunc() + "')";
System.out.println(Sql);
stmt.execute(Sql);
Conexao.con.commit();
Conexao.CloseDB();
return true;
} catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
}
public boolean excluirFuncionario(FuncionarioDTO funcionarioDTO) {
try {
Conexao.ConnectDB();
Statement stmt = Conexao.con.createStatement();
String Sql = "Delete from Funcionario where id_funcionario = "
+ "'" + funcionarioDTO.getId_funcionario() + "'";
stmt.execute(Sql);
Conexao.con.commit();
Conexao.CloseDB();
return true;
} catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
}
public boolean alterarFuncionario(FuncionarioDTO funcionarioDTO){
try {
Conexao.ConnectDB();
Statement stmt = Conexao.con.createStatement();
String Sql = "Update Funcionario set " + "nome = '"
+funcionarioDTO.getNome() + "', " + "cpf = '"
+funcionarioDTO.getCpf() + "', " + "rg = '"
+funcionarioDTO.getRg() + "', " + "ctps = '"
+funcionarioDTO.getCtps() + "', " + "datanascimento = '"
+funcionarioDTO.getDatanascimento() + "', " + "sexo = '"
+funcionarioDTO.getSexo() + "', " + "dataadmissao = '"
+funcionarioDTO.getDataadmissao() + "', " + "datademissao = '"
+funcionarioDTO.getDatademissao() + "', " + "cargo = '"
+funcionarioDTO.getCargo() + "', " + "endereco = '"
+funcionarioDTO.getEndereco() + "', " + "complemento = '"
+funcionarioDTO.getComplemento() + "', " + "bairro = '"
+funcionarioDTO.getBairro() + "' " + "cidade = '"
+funcionarioDTO.getCidade() + "', " + "uf = '"
+funcionarioDTO.getUf() + "', " + "cep = '"
+funcionarioDTO.getCep() + "', " + "telres = '"
+funcionarioDTO.getTelres() + "', " + "email = '"
+funcionarioDTO.getEmail() + "', " + "comissao = '"
+funcionarioDTO.getComissao() + "', " + "Usuario = '"
+funcionarioDTO.getUsuario() + "', " + "senha = '"
+funcionarioDTO.getSenha() + "', " + "situacao = '"
+funcionarioDTO.getSituacao() + "', " + "codfunc = '"
+funcionarioDTO.getCodfunc() + "' " + "where id_funcionario = '"
+funcionarioDTO.getId_funcionario() + "'";
stmt.execute(Sql);
Conexao.con.commit();
Conexao.CloseDB();
return true;
}catch (Exception e) {
System.out.println(e.getMessage());
return false;
}
}
public void Buscar(){
try{
Conexao.ConnectDB();
Statement stmt = Conexao.con.createStatement();
String Sql = "Select nome, cpf from funcionario";
ResultSet rs = stmt.executeQuery(Sql);
}catch (SQLException e){
e.printStackTrace();
}
}
}
ali eu fiz um SQL....
agora eu precisava jogar essa SQL em uma JTable que esta no JFrame que esta no meu VIEW mais eu naum to conseguindo :/
por favor me desculpem mesmo pela ignorancia o.O
vlwwwww

