Use the join is another matter from Something s, RelatedElements re where re.class = "Product"
2009/4/1 Bartosz Pierzchlewicz <[email protected]> > > Thanks for response, > I'am searching for more efficent solution. > In such situation (<many-to-any>) we have one query for mapping table, > and one for each element in collecion? > I even think to do this in multiquery, but we need access to metadata > (id and class). Do you know how to do it with current wersion? > > Another solution is to point NH to make join with specified tables, > but as you told it is imposible without modification od NH. > > -- > Bartosz Pierzchlewicz > > > > On 31 Mar, 14:52, Fabio Maulo <[email protected]> wrote: > > Not possible using <any> or <many-to-any> because NH need to load the 2 > > field before know which is the table to hit. > > > > 2009/3/31 Bartosz Pierzchlewicz <[email protected]> > > > > > > > > > > > > > > > > > Hi, > > > my mapping: > > > > > <bag name="RelatedElements" access="property" > > > table="RelatedElementsToCategory" lazy="true"> > > > <key column="elemId" /> > > > <many-to-any id-type="Int32" meta-type="System.String"> > > > <meta-value value="Product" class="DataLibrary.DbProduct, > > > DataLibrary" /> > > > <meta-value value="Category" > > > class="DataLibrary.SimpleDictionaries.DbRelatedCategory, DataLibrary" / > > > > > <column name="elemType" /> > > > <column name="RelElemId" /> > > > </many-to-any> > > > </bag> > > > > > I spend several hours trying to eager fetch RelatedElements > > > collection. > > > I tried both HQL and Criteria API. Still without result. > > > I also tried to do this using multiquery, but RelatedElements didn't > > > contains 'id' and 'class' fields (mentionen in > > > > >http://groups.google.com/group/nhusers/browse_thread/thread/f5ebef1e6. > .. > > > ). > > > > > Did anyone tried to do this? > > > > > I'am using NHibernate 2.1.0.1001 (January 2009) > > > > -- > > Fabio Maulo > > > -- 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] 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 -~----------~----~----~----~------~----~------~--~---
