Thank you for your answer Markus, I'm still having trouble to understand how do you query about random nodes without having their direct parent object ?
On Tue, Aug 10, 2010 at 5:12 PM, Markus Zywitza <[email protected]>wrote: > I'm using an ancestor list when having complex object trees. The type > (i.e. Entity) has a collection called Ancestors (normally of type > IList<Entity>), which contains all its ancestors from root to its > direct parent in order. When a new node is created, it inherits its > parent's ancestor plus the direct parent itself. > > When I want to query a subtree, I use the ancestors list to fetch only > the required instances. The downside is that with very large trees you > get a very large ancestors table. Since the whole subtree is in the > first level cache then, you can query the relative root object in a > second query without hitting the database again. > > -Maorkus > > 2010/8/9 Dor Kolog <[email protected]>: > > Sorry for not being clear. Let's assume you have the root as an object > and > > you want to query about some nodes in the tree according to some > criterion. > > The nodes are not connected directly to the root and can be anywhere in > the > > tree. > > > > On Mon, Aug 9, 2010 at 9:04 PM, José F. Romaniello < > [email protected]> > > wrote: > >> > >> Could you show some mappings? It is hard to follow you with those R, D > and > >> L > >> > >> 2010/8/9 MadCow <[email protected]> > >>> > >>> Hi, > >>> In a project I'm working on, I use NHibernate over MS-SQL. I use the > >>> database to represent trees (one-to-many relation) > >>> I want, in some way, to query on different nodes in a single tree, or > >>> a single path in the tree, where the nodes are not connected directly, > >>> Meaning, if a root R has a descendant D, whose one of its descendants > >>> is a leaf L, I want to query on D based on parameters of L and R (or > >>> vice-versa, according to R and L query on D). > >>> > >>> Is there a way to represent this query in NHibernate ? As far as I > >>> know, QBE almost serves my needs. Is there a better way doing this ? > >>> > >>> Thanks. > >>> > >>> -- > >>> 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]<nhusers%[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]<nhusers%[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]<nhusers%[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]<nhusers%[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.
