Skip to content

Instantly share code, notes, and snippets.

@pedromtavares
Created April 28, 2010 14:01
Show Gist options
  • Save pedromtavares/382177 to your computer and use it in GitHub Desktop.
Save pedromtavares/382177 to your computer and use it in GitHub Desktop.
public void removerLojas(){
Query query = manager.createQuery("select l from Loja l");
List<Loja> lojas = query.getResultList();
Loja loja = lojas.get(0);
List<Produto> produtos = loja.getProdutos();
Produto produto = produtos.get(0);
manager.getTransaction().begin();
manager.remove(lojas.get(1));
manager.remove(produto);
manager.getTransaction().commit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment