I am assuming that you have mapped Folder with a colleciton of Files, like this:
Code:
<class name="Folder" ...>
...
<set name="Files" ...>
<key column="folderId"/>
<one-to-many class="File"/>
</set>
...
</class>
That's where the join is specified. That way, hibernate does all the joining for you when you create a query like this
Code:
from Filter f where f.File.name = :filename
So you don't specify a join in the query.
In the query that you wrote, the select specified "folder.foldername, folderfiles.filename". This will cause the object returned from query.list() to be an array of Objects, where the first element is a String with the name of the folder in it, and the second element is a String with the name of the file in it. While that may be sufficient, you would prefer Folder objects, where each Folder has the correct File objects in the getFiles() collection. That's what my query does.
If you need to know more, check out the hibernate ref docs.