NHibernate Save Details Performance
I am new to NHibernate. As I am doing some dummy applicaiton to learn, I got a doubt. I request you please clarify me on my question.
I am doing a reset password page in which I am fetching the user details and resetting the passw开发者_高级运维ord and save back to the database.
1) Do I need to retrieve complete(whole row) details of the user.
2) If yes, I dont really need all the details of the user apart from his/her emailId to which I need to send an email.
3) If no, then how NHibernate knows that which details I changed while saving. How can I tell to NHibernate that you need to update only password column.
Please clarify.
Mahesh
In your mapping files, you can specify which properties to 'lazyload'. This means they won't be fetched the first time you query, but only when you actually use the property in code, at runtime.
Usually this is only done for properties that point to other tables and aren't always needed. Retrieving the whole row of one table should not hinder performance. You can retrieve the object via NHibernate, change the property, and save it back to the database. You shouldn't have to worry about anything else then.
For the question on how NHibernate knows what to update: check this FAQ.
精彩评论