IdMap

On Wed, Apr 20, 2011 at 9:02 AM, Øyvind <[email protected]> wrote:

> Hello,
>
> I've got a user and a place entity, and a relationship mapped between
> them using a 'UserPlace' entity (A user can belong to many places).
> The mapping, with FluentNH, is below. This works fine, but I've
> noticed that every time I modify a User's UserPlace (setting a place
> as default or selected) the entire collection of UserPlace is first
> deleted from the database, and then reinserted. I assume it's because
> NHibernate doesn't know enough about what distinguishes one row from
> another, so how can I change my mapping to prevent a complete deletion
> and re-insertion of all rows?
>
> public class UserMap : ClassMap<User>
> {
>    HasMany(x => x.Neighbourhood)
>      .Component(c =>
>        {
>          c.Map(x => x.IsDefault).Not.Nullable();
>          c.Map(x => x.Selected).Not.Nullable().Default("0");
>          c.References(x => x.Place).Fetch.Join();
>        }
>      ).Not.LazyLoad().Cascade.SaveUpdate();
> }
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to