Hi, Fabio! Never without FK! What I would like is something like this:
<many-to-one name="Customer" column="`customer_id`" not-null="true" fetch="join" lazy="false" where="deleted = 0" /> SELECT ... FROM [Order] o INNER JOIN [Customer] c ON o.customer_id = c.customer_id AND c.deleted = 0 This way, if I ever "soft delete" a Customer which is associated with a not "soft-deleted" Order, if I try to load this Order, it will fail. What is the dynamic-filters functionality that you are referring? How can I apply it to a many to one association? Thanks! RP PS - I will switch to the nhusers. On Sep 6, 4:17 pm, Fabio Maulo <[email protected]> wrote: > btw the feature, with its deep thinking and discussion, is already there. > If you want "obscure" the existing relation because the record was > "soft-deleted" you can use dynamic-filters that will be applied when/if the > query has an explicit join (note explicit join). > If you use the "where" in the mapping the result will be the same than set > the relation to null. > > The nhuser groups could be more appropriate. > > > > > > > > > > On Tue, Sep 6, 2011 at 12:12 PM, Fabio Maulo <[email protected]> wrote: > > without FK ? > > > On Tue, Sep 6, 2011 at 11:13 AM, Ricardo Peres <[email protected]> wrote: > > >> Hello, > > >> Has the inclusion of a where clause in many to one associations ever > >> been considered? > >> This would help, for example, in avoiding loading "soft deleted" > >> entities. > >> The where clause would be applied to the join in the on clause or to > >> the where in case of a select. > >> Do you have good reasons against it? If not, I will create a JIRA > >> issue. > > >> Thanks! > > >> RP > > >> PS - I am not posting to NHibernate Users because I think it is more > >> appropriate here. > > > -- > > Fabio Maulo > > -- > Fabio Maulo
