I'm quite new to Hibernate and have a question. What is the difference between deleting an object by using an HQL query and deleting an object by using the delete(...)
Method of the Session
Class?
Session.delete(...)
is only useful if you already have a reference to the entity you want to delete.
delete-by-query is useful for deleting several objects according to certain criteria, objects that you may not have previously loaded into the session.
I believe that delete-by-query actually loads each entity into the session and deletes them individually - someone correct me if I'm wrong on this.