Each document has a FolderID column, which is a foreign key to its containing folder.
Normally, in NH, I you'd map this as a many-to-one on Document, pointing at Folder, and a collection of some sort on Folder, containing Documents. Right? But like I say, I'm not using any association mappings (i have my reasons, trust me). Supposing my select was select f, d from .... then ideally, I'd get back something like a list of tuples where the first item is the folder and the second is a document. Yes, I'd get a separate result for each document, with the same instance of the Folder as the other children of the same folder. I'd have to gather them up and build the collection by folder. No problem there. Empty folders would be represented by a tuple with folder and a null document. Or maybe every folder would have an entry with a folder and a null, whether it is empty or not. Make sense? On Sep 14, 7:05 pm, Diego Mijelshon <[email protected]> wrote: > If you have a FolderID in the Document, you are NOT mapping it as I would > imagine... > > Also, what are you trying to retrieve with your query? all folders with all > their documents? > > Diego > > On Tue, Sep 14, 2010 at 22:26, rsr <[email protected]> wrote: > > Say I've got two tables Folder and Document related as you can > > imagine, and mapped in NH using just a simple property FolderID on the > > Document entity. i.e. - no many-to-one mapping. > > > I can do an HQL inner join by using > > from Folder f, Document d where f.FolderID = d.FolderID > > and that's great. > > > My question is - how can I turn that into a left join, so that I can > > get folders that have no documents? > > > 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]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
