Even though I can modify the schema in this case, it's really a virtual model that I'm after.
I want to have something that I can use inside NH with it's caching and querying capabilities, compose easily from the existing data, and something that is immutable. Perhaps I should have created a VIEW in the schema and tried to map to that, it would be essentially the same. But, is that a recommended approach for these scenarios? Thanks. On May 21, 10:20 am, Hudson Akridge <[email protected]> wrote: > That works :) > You may also look at mapping those two parts polymorphicly, i.e. map an > IPart to an I_Parts table, then map a Part as a join subclass to IPart, with > it's table of Parts, then map the ReadOnlyPart to a join subclass with IPart > with it's table of ProductionParts. > That would of course mean that the I_Parts table contains an index of both, > but the actual fields that represent the part would exist in two separate > tables which could then have various read-only and read-write attributes > placed upon them. > > On Thu, May 21, 2009 at 9:09 AM, Brett Veenstra > <[email protected]>wrote: > > > > > 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 -~----------~----~----~----~------~----~------~--~---
