public Ladies salvar(Ladies ladies) throws Exception { EntityManager manager = ConectionFactory.getConnection(); manager.getTransaction().begin(); ladies = manager.merge(ladies); manager.getTransaction().commit(); return ladies; }
public List<Ladies> listar(String nome) throws Exception { EntityManager manager = ConectionFactory.getConnection(); manager.getTransaction().begin(); Query q = manager.createQuery("select l from Ladies l order by l.vendas.dataVenda "); List<Ladies> lista = q.getResultList(); manager.getTransaction().commit(); return lista; }