开发者

Difference between HQL delete query and session.delete()

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 t开发者_如何学Pythonhe 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜