Hi,

I ran into this problem that I can't solve for some time now:

I have two entities: User and Job

A User has FavoriteJobs. This is a many-to-many association with Job. Also, 
this association is filtered so that only active (not archived) jobs are 
fetched.

The mapping for the FavoriteJobs association looks like this (using 
FluentNHibernate)

HasManyToMany(x => x.FavoriteJobs)
.Table("UserJob")
.ParentKeyColumn("UserId")
.ChildKeyColumn("JobId")
.ApplyChildFilter<ExcludeArchivedJobsFilter>("IsArchived = :condition")
.Cascade.None();

A job can be archived and un-archived at any time from the application.

When fetching users, the FavoriteJobs collection is populated with the 
right jobs, only the active ones.

The problem is that when I want to save a User, all the jobs that were 
filtered are being treated as though their association has been broken and 
are deleted from the crossreference table (just like the user marked the 
filtered jobs as not being favorite anymore).

I am wondering if there are any patterns to mark the filtered entries as 
being just filtered and not deleted.

Something like disabling the filter from the mapping when there is an 
update event.

I would appreciate any ideas,
Adrian.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/jyGbqC2xm1cJ.
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