Hello together, I currently work on a project where I use nHibernate in a pretty big WCF service application. After some time I made a design decision to use collections mappings really rare to reduce the amount of data transfered to the client. Using lazy loading does not work for me because the client decides which members of the entities he will need for a special functionality. I only use many-to-one relations. For the client, this is ok. When I need a list of objects on the client, the wcf service offers a really powerfull search method per entity class. This search method gets a object tree describing the complex search criteria. This search methods translates the object tree into an corresponding ICriteria object.
Now this works fine as long as I only need to join along the many-to- one relations. But if I need to join on a child table, I cannot use ICriteria.CreateCriteria to generate a join to the so table because my entities does not contain any collections mappings. I know that I can solve it via DetachedCriteria / SubSelects, but this is a really ugly solution, it blows my SQL statements up too much. Is there a way to create a SELECT like SELECT DISTINCT f.* FROM Folder as f INNER JOIN FolderLanguage as fl ON f.FolderID = fl.FolderID INNER JOIN FolderCategory as fc ON f.FolderID = fc.CategoryID INNER JOIN Category as c ON fc.CategoryID = c.CategoryID INNER JOIN CategoryLanguage as cl ON fc.CategoryID WHERE fl.Label LIKE 'MyFolder%' AND c.Type=4 AND cl.Label='SampleCategoryNameInGerman' AND cl.Language = 'DE' with Session.CreateCriteria<Folder>(... without having collection properties like "Folder.Languages", "Folder.Categories", "Category.Languages"? regards Dirk --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
