Hello,
i have classes like these:
Code:
public class Foo
{
Long id;
Set bars = new HashSet();
Date date;
}
public class Bar
{
Long id;
String name;
}
Which means one Foo can have several Bars. There is a many to many relation between Foo and Bar tables in the DB. so, i amde mappings like this:
Foo.hbm.xml (table FOO)
---------------
Code:
...
<set name="bars" cascade="save-update" table="FOO_BAR">
<key column="FOO_ID"/>
<many-to-many class="Bar" column="BAR_ID"/>
</set>
....
Bar.hbm.xml (table BAR)
---------------
just BAR_ID and name property..
Now, i want to make a query, with these criterias:
input: startDate, endDate
i want to find the most frequently used 10 Bar names and their counts within the Foo's which created between "startDate" and "andDate" (creation date is Foo.date). i tried a lot but i couldnt find the correct HQL for these.. Any help?
Hibernate version:
2.1.2