//As we can't store the display image in the viewstate, we have to //refresh it before it's saved, or it'll get overwritten with null. //this unfortunately causes a redundant dbase hit, ah well. //we'd need to do this for optimistic concurreny in the future anyhow if (p.Id != 0) //only properties that have been saved can have images. { Property imageTest = session.Load(typeof (Property), p.Id) as Property; if (imageTest != null) p.DisplayImage = imageTest.DisplayImage; //Make hibernate forget this instance or it'll get confused session.Evict(imageTest); }