开发者

Delete with QueryOver?

开发者 https://www.devze.com 2023-02-14 20:04 出处:网络
I would like to improve my code when deletinga group of objects in NHibernate (V3). Currently, I iterate on a retrieved collection and I call delete on each object. This generates n+1 SQL statements.

I would like to improve my code when deleting a group of objects in NHibernate (V3). Currently, I iterate on a retrieved collection and I call delete on each object. This generates n+1 SQL statements.

I notice that NHibernate Session provides this method : Delete(string query)

By using this method I think I can do the same thing with a single SQL statement.

Do you开发者_开发知识库 know if there is a way to combine this method with QueryOver API to avoid HSQL ?


As far as I know the only way to do single-shot deletes and updates is using HQL. As a compromise, you might want to take a look at this workaround.

0

精彩评论

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