Thanks! From: [email protected] [mailto:[email protected]] On Behalf Of Fabio Maulo Sent: den 19 oktober 2010 14:38 To: [email protected] Subject: Re: [nhusers] Filter condition + default schema
aaaaaaaaaaaaahhh IIRC <filter> and <formula> are plain SQL What you can do is declare the condition in a filter-def and then add a different XML for each schema. The other option is do it by code (you can add filter-def through Configuration instance). On Tue, Oct 19, 2010 at 9:29 AM, Roger Kratz <[email protected]<mailto:[email protected]>> wrote: I was hoping that default_schema also applied in filter condition. When using another table/entity in a filter, the default_schema won't be used for that part of the query. Ok, trying with a pseudo example.... <class name="Order"> [...] <many-to-one name="Person" .../> <filter name="deletedPeopleFilter" condition="exists(select 1 from Person p where Person=p.Id and p.IsDeleted=0)"/> </class> Lets say default_schema is set to "Foo.dbo"... Querying for some order when filter is enabled result in a query something like this... select [..] from Order this_ where [...] and exists(select 1 from Person p where this_.Person=p.Id and p.IsDeleted=0) ...I would like... select [..] from Order this_ where [...] and exists(select 1 from Foo.dbo.Person p where this_.Person=p.Id and p.IsDeleted=0) Is it possible? Does NH know what "Person" is or is it just plain text/sql meaning it can't be done? From: [email protected]<mailto:[email protected]> [mailto:[email protected]<mailto:[email protected]>] On Behalf Of Fabio Maulo Sent: den 19 oktober 2010 13:56 To: [email protected]<mailto:[email protected]> Subject: Re: [nhusers] Filter condition + default schema The filter is dynamic (to be enabled at run-time for certain sessions). What you are looking for exactly ? On Tue, Oct 19, 2010 at 8:28 AM, Roger Kratz <[email protected]<mailto:[email protected]>> wrote: Hi If I have a default schema configured, eg like this <property name="default_schema">Foo.dbo</property> ...I was hoping that this default_schema somehow also applied to filter conditions... <filter name="someName" condition="exists(select 1 from Bar b where ....)"/> Can I/How do I easiest make NH send... [...] where exists(select 1 from Foo.dbo.Bar [...] ...without hard coding this in the filter condition? Not possible out-of-the-box? /Roger -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]<mailto:[email protected]>. To unsubscribe from this group, send email to [email protected]<mailto:nhusers%[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]<mailto:[email protected]>. To unsubscribe from this group, send email to [email protected]<mailto:[email protected]>. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]<mailto:[email protected]>. To unsubscribe from this group, send email to [email protected]<mailto:nhusers%[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]<mailto:[email protected]>. To unsubscribe from this group, send email to [email protected]<mailto:[email protected]>. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en. -- 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.
