public void preencheCampos(setoresBean sb) { Object codigo = sb.getCod(); String codS = "" + codigo; campoCod.setText(codS); campoDataAlteracao.setText(sb.getDataAltera()); campoInclusao.setText(sb.getDataInclusao()); campoDescricaoSet.setText(sb.getDescricao()); campoInclusao.setText(sb.getUserInclusao()); campoMunicipio.setText(sb.getMunicipio()); campoSigla.setText(sb.getSigla()); campoUserAltera.setText(sb.getUserAltera()); }
public void preencheCamposSetores(EntityManagerFactory factory, EntityManager manager, int cod) { setoresBean sb = new setoresBean(); manager.getTransaction().begin(); Setores s = manager.getReference(Setores.class, cod); sb.setMunicipio(s.getMunicipio()); sb.setSigla(s.getSigla()); sb.setDescricao(s.getDescricao()); sb.setDataInclusao(s.getDatainclusao()); sb.setUserInclusao(s.getUserinclusao()); sb.setUserAltera(s.getUseraltera()); sb.setDataAltera(s.getDataaltera()); manager.getTransaction().commit(); preencheCampos(sb); manager.close(); factory.close(); }