Get associated items by OQL

Hello. I would like to ask how to get data with reference by OQL. I make a domain model with self-reference association like below.   I wrote this OQL, but the result is the list without reference. I cannot get associated data. FROM Folder LEFT OUTER JOIN Folder/Folder_SubFolder/Folder How can I get ‘Folder’ data as well as ‘SubFolder’ data?
2 answers

Hi Taiga,

OQL is not like xpath you have some limitation.

Did you already checked the playground app :

It helps to understand the OQL a bit better.



select Name from MyFirstModule.Folder f
join f/MyFirstModule.Folder_SubFolder/MyFirstModule.Folder a;


That would be:

from yourdomain.Folder F
join F/yourdomain.Folder_SubFolder/yourdomain.Folder SubF
select *

You will get a denormalized, flat file. So not grouped by folder:

- folder a, subfolder x

- folder a, subfolder y

- folder a, subfolder z

- folder b, subfolder g

Also, you probably need the association the other way to have one folder have many subfolder.