Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update data without retrieving

Can NHibernate update some (not all) fields in the table row without retrieving any data? I know Id of the entity.

like image 563
Sergey Metlov Avatar asked Jan 21 '23 00:01

Sergey Metlov


2 Answers

You can find all the examples here:

http://nhibernate.info/doc/nh/en/index.html#batch-direct

like image 152
Diego Mijelshon Avatar answered Feb 01 '23 18:02

Diego Mijelshon


session.CreateQuery("update Foo f set f.Date = :date where f.Id = :id")
    .SetParameter("date", DateTime.Now)
    .SetParameter("id", 25)
    .ExecuteUpdate();
like image 45
rebelliard Avatar answered Feb 01 '23 20:02

rebelliard