Hi I have quiry on hibernate mapping in generating hql for the below scenario
I have a ClassA (TableA) which has 1-M mapping to ClassB(TableB)
In ClassA I have collection of ClassB (1-M mapping)
When I run the hql based on the search criteria on ClassA. It is working fine and I am getting list of ClassA, with each ClassA instance having collection of ClassB
select * from ClassA a where a.col1="A" and a.col2="B"
Now the issue is when I want to add seach condition for ClassB. How to get instance of ClassB to make a seach hql? expected results should be "list of ClassA with each CLassA instance having collection of ClassB"
I tries the below hql, select * from ClassA a join ClassB b where a.col1="A" and b.col1="B"
But I am not getting expected results. Instead I am getting List of List. Where each list has ClassA and ClassB. Instead of collection in Class A, I am getting one List for reach record in ClassB
Some pls assist me on this.
Thanks!
|