Hi, I have a Process object and table.
This process table represents a tree-structure of Process objects with each one having a reference to the ID of the process' root process.
What i would like to do is list all processes, ordered by the name of the root process.
Something like this.
select p from
HibProcess p,
HibProcess r
where
p.RootProcessID = r.ProcessID
order by
r.Name asc
Unfortunately this does not order correctly at all. When I order by p.Name or any other property on p it works perfectly, however it cannot seem to order by the joined Process' properties.
My RootProcessID property is setup as a many-to-one relationship.
I am using Hibernate 2 I believe.
The Hibernate docs mention that doing these self-referencing queries require multiple select statements and will affect sorting!
How on earth do I get this to work?
Any help would be great. Cheers.
|