-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Filter a tree of objects using HQL
PostPosted: Mon Jun 16, 2014 7:19 am 
Newbie

Joined: Mon Jun 16, 2014 6:22 am
Posts: 1
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?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.