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(); }