<p>I have a User object that has a Country object on it. I map this with a many-to-one tag in the User mapping file:</p>

<pre><code>&lt;many-to-one name="Country" column="CountryID" cascade="none"/&gt;
</code></pre>

<p>How do I update a User's country?</p>

<p>At the moment my UI has a dropdown of countries and the ID of the new country is passed to the controller. The controller then sets the ID of the User's country from that value. So:</p>

<pre><code>var user = session.Get&lt;User&gt;(userID);
user.Country.ID = Convert.ToInt32(Request.Form["Country_ID"]);
</code></pre>

<p>But when I call:</p>

<pre><code>session.SaveOrUpdate(user);
</code></pre>

<p>I get an error saying that "identifier of an instance of Country was altered from 7 to 8". Presumably this is because the Country object is marked as dirty by NHibernate? I don't want to update the country object though, just the ID reference in the User. Is it possible to do it this way?</p>

<p>Thanks,
Jon</p>

```
```
var user = session.Get<User>(userID);
user.Country = session.Get<Country>(Convert.ToInt32(Request.Form["Country_ID"]));
```
```
You must retrieve the country from the database and then set it to the user