Hello, I have an HQL problem for which I can't find a suitable solution.
Lets suppose that I have entity A. A can be linked to another A through another entity, B.
so I have this
A to B: one - to - many B to A: many - to - one
So I have a tree like hierarchy like this
-----------------A(*)---------------- -----------------|------------------- |----------------|---------------|---- B<-A(*)---------B<-A(*)---------B<-A ----|--------------------------------| ----|--------------------------------| |------|-----------------------------| B<-A--B<-A(*)----------------------B<-A(*)
There is a property in A named enabled. I want write an HQL query that fetches all top-level As and their Bs that have an A with enabled=true (which are marked in the tree with *).
In essence, the tree I would like to get as a result would be this
-----------------A(*)---------------- -----------------|------------------- |----------------|------------------- B<-A(*)---------B<-A(*)------------- ----|-------------------------------- ----|-------------------------------- |------|----------------------------- -------B<-A(*)----------------------
Is this possible to achieve this kind of result using HQL? If true, can you offer some insight on how?
|