I'm using NHProf and I'm confused why NHibernate is updating an entity after it selects it and the transaction/session is committed/closed.
Here is the output from NHProf:
1. begin transaction with isolation level: unknown
2. SELECT job0_.jobid as jobid2_0_, job0_.name as name2_0_, job0_.tags as tags2_0_, job0_.dateCreated as dateCrea4_2_0_, job0_.lastModified as lastModi5_2_0_, job0_.nextRunDate as nextRunD6_2_0_, job0_.validationStatus as validati7_2_0_, job0_.validationErrors as validati8_2_0_, job0_.schedCron as schedCron2_0_, job0_.schedCronStart as schedCr10_2_0_, job0_.schedCronEnd as schedCr11_2_0_, job0_.schedCronExDates as schedCr12_2_0_, job0_.schedSimpleStart as schedSi13_2_0_ FROM Jobs job0_ WHERE job0_.jobid=@p0
3. commit transaction
4. UPDATE Jobs SET validationStatus = @p0 WHERE jobid = @p1 AND validationStatus=@p2
Here is the sql generated by the last Update statement:
Code:
UPDATE Jobs
SET validationStatus = 1 /* @p0 */
WHERE jobid = 'b6cdfe2e-59a8-4152-8d06-12dd8870faab' /* @p1 */
AND validationStatus = 1 /* @p2 */
Seems completely unneccessary.