-->
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: Cannot create HQL for a confusing query..
PostPosted: Tue Sep 28, 2004 2:57 pm 
Beginner
Beginner

Joined: Fri Jan 23, 2004 10:26 am
Posts: 21
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


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.