I am new in nhibernate .I want to get specific columns in my query(Because of performance .vs..)
I make it with this code
DetachedCriteria criteria = DetachedCriteria.For<Musteri>(); ProjectionList props = Projections.ProjectionList(); props.Add(Projections.Property("MusteriId"), "MusteriId"); props.Add(Projections.Property("Adresi"), "Adresi"); props.Add(Projections.Property("MusteriAdi"), "MusteriAdi"); criteria.SetProjection(Projections.Distinct(props)); criteria.SetResultTransformer(new AliasToBeanResultTransformer(typeof(Musteri)));
NHibernate.ICriteria c = criteria.GetExecutableCriteria(nhSession); Musteri Sonuc = ((Musteri)c.UniqueResult()); nhSession.Evict(null); nhSession.Clear(); Sonuc.Adresi = "12"; nhSession.Update(Sonuc); nhSession.Flush();
My Problem is if I run that code it try to update all columns (not only I added before props.Add(Projections.Property )
How I can resolve this only update specific columns of entity which I load before with props.Add(Projections.Property("MusteriAdi"), "MusteriAdi");
Note ı try update_statement=true in hbm.xml but not solved
|