Hi,

 I am trying to delete entities from the datastore using JPA's
entityManager remove method as in the following code. When I execute,
the entities are not removed from the datastore but when I use the
"Delete x from Node x" query, the entities are removed from the
datastore.


Query query = em.createQuery("SELECT x FROM Node x");
List<Node> results = (List<Node>) query.getResultList();

  try {
            for (Node result : results) {
              Node removeNode = em.find(Node.class, (int)
(result.getKey().getId()));
              em.remove(removeNode);

           }
       }
finally {
               em.close();
        }



Can someone please explain if I have done anything wrong in the above
code/ why "remove" does not delete the entries from the datastore?

The delete query works , but I'd like to know if it's good programming
practice to use the delete query instead of the entity manager's
remove method,

Thanks,
Deepika

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to