I think I have it working now...


        public Part()
        {
            WithTable("t_Part");

            Id(i => i.Id).ColumnName("PartID");
            Map(m => m.Name).ColumnName("Part");

            SetAttribute("where", "PartID IN ( SELECT pp.PartID FROM
PartProduction pp ) ");

            ReadOnly();
        }

I couldn't find how to use FNH to specify the "where" element on the
HBM "class", so I just used the SetAttribute.

Thanks folks!




On May 21, 9:21 am, Stuart Childs <[email protected]> wrote:
> Well, I had been typing out a response here but then you had to go and post
> a SO question and I'm a rep whore :P
> Hope it helps, and like Hudson said, we're always happy to help even when
> the questions are much more NH related.  We just want to make sure you get
> the best help and the NH forum is probably populated with all sorts of
> mapping experts. :)
>
> On Thu, May 21, 2009 at 8:08 AM, Brett Veenstra 
> <[email protected]>wrote:
>
>
>
> > The SQL that I would expect for this Model would be:
>
> > SELECT p.*
> > FROM t_Part p
> > INNER JOIN t_PartProduction pp ON pp.PartID = p.PartID
> > WHERE pp.ProductionYear = '?'
>
> > Considering Hudson's earlier comment that I should post this to the
> > NHUsers group, I apologize.  Since I didn't want to just blatantly
> > cross-post, I setup a StackOverflow question for this:
>
> >http://stackoverflow.com/questions/892820/nhibernate-incorrect-thinki...
>
> > Since I'm a n00b to NH and it's been made more approachable through
> > FNH, I posted here first, sorry guys.
>
> > Thanks for any ideas!
>
> > On May 20, 6:46 pm, Rei <[email protected]> wrote:
> > > Could you please explain in more detail what it is that you want to
> > > do?
>
> > > On May 20, 11:03 pm, Brett Veenstra <[email protected]> wrote:
>
> > > > I'm trying to produce a read-only view of several of my entities.
>
> > > > For example, a "Part" sits in a "Part" table (Read/Write), but a
> > > > "ProducedPart" is a Part that has rows in a "Production" table (Read-
> > > > Only).  I want to be able to generate a distinct list of
> > > > "ProducedPart" based on the production data.
>
> > > > What I think I need is a way to apply a filter during the Mapping
> > > > phase that takes other Entities into account.  How would I map this?
>
> > > > Is this a proper problem for NHibernate to solve?
>
> > > > Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to