Search code examples
c#cachingnhibernatehqlbulkupdate

How to do bulk save / updates without using HQL?


I can use HQL to do bulk operations but these operations do not update the first level cache of NHibernate, so I'm facing various problems because I do not want to clear the session or refresh objects.

Is there any way of performing bulk updates / deletes without using HQL or native SQL with affecting the in-memory state of NHibernate cache?


Solution

  • So, it seems that the only way is to handle it manually and refresh the object:

    session.Refresh(entity);