Estou montando um Sistema de Gerenciamento de Biblioteca e montei várias telas de cadastro consulta edição e exclusão
o meu problema inicia exatamente na classe DaoAluno nessa classe de persistência, faço os comando de Insert into funciona blz, mas faço entra no update
me apresenta o seguinte erro
public void save(Aluno aluno){
Database database = null;
try{
database = Database.getInstance();
Statement stmt = database.getConnection().createStatement();
String sql ="";
if((aluno.getId()== null) ||(aluno.getId()==0)){
sql = "insert into aluno(nome,sobrenome,data_nascimento,rg,cpf,nome_mae,nome_pai,responsavel,telefone,celular,endereco,num_casa,bairro) values(" + "'" + aluno.getNome() + "','" + aluno.getSobrenome() + "','" + aluno.getData_nascimento()+"','" + aluno.getRg()+
"','"+aluno.getCpf()+"','"+aluno.getNome_mae()+"','"+aluno.getNome_pai()+"','"+aluno.getResponsavel()+"','"+aluno.getTelefone_contato()+"','" +aluno.getCelular() +"','"+aluno.getEndereco()+ "','" + aluno.getNumero_casa()+"','"+aluno.getBairro()+ "')";
stmt.execute(sql,Statement.RETURN_GENERATED_KEYS);
ResultSet rst = stmt.getGeneratedKeys();
if(rst.next()){
aluno.setId(rst.getInt(1));
}
}else{
sql = "update aluno set nome = '" + aluno.getNome() + "', "
+ "sobrenome = '" + aluno.getSobrenome() + "', "
+ "data_nascimento = '" + aluno.getData_nascimento() + "', "
+ "rg = '" + aluno.getRg() + "', "
+ "cpf = '" + aluno.getCpf() + "', "
+ "nome_mae = '" + aluno.getNome_mae() + "', "
+ "nome_pai = '" + aluno.getNome_pai() + "', "
+ "responsavel = '" + aluno.getResponsavel() + "', "
+ "telefone = '" + aluno.getTelefone_contato() + "', "
+ "celular = '" + aluno.getCelular() + "', "
+ "endereco = '" + aluno.getEndereco() + ", "
+ "num_casa = '" + aluno.getNumero_casa() + "'"
+ "bairro = '" + aluno.getBairro() + "'"
+ "where idaluno = " + aluno.getId();
stmt.execute(sql);
}
System.out.println(sql);
database.getConnection().commit();
}catch(SQLException e){
try{
database.getConnection().rollback();
}catch(SQLException e1){
e1.printStackTrace();
}
e.printStackTrace();
}
}
[color=red]org.postgresql.util.PSQLException: ERRO: erro de sintaxe em ou próximo a "55"
Posição: 283
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1810)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:372)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:364)
at sistema_biblioteca.dao.DaoAluno.save(DaoAluno.java:52)
at sistema_biblioteca.session.SessionAluno.save(SessionAluno.java:21)
at sistema_biblioteca.gui.ManterAlunoGUI.salvar(ManterAlunoGUI.java:370)
at sistema_biblioteca.gui.ManterAlunoGUI$TrataEventoBotao.mouseClicked(ManterAlunoGUI.java:47)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)[/color]
só retomando, ele salva normalmente mas no momento em que eu vou editar o campo numero, ou se eu comento esse campo o campo bairro apresenta este erro indicado
alguém manda um help ai =D
vlw