-->
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: HQL Query.....
PostPosted: Fri Oct 15, 2004 10:54 am 
Beginner
Beginner

Joined: Tue Oct 05, 2004 5:15 am
Posts: 23
I'm having a bit of a problem coming up with an HQL query, and wondered if someone could help me....

In my domain model, I have a Topic, User and Subscription.
A Topic has a set of Subscriptions against it, and each Subscription belongs to a User. A User can have many simultaneous Subscriptions and additionally has the concept of a default subscription.

Setting up the mappings and doing simple creats / finds has been fine.

However, I want to enforce that a Topic can not be deleted if it contains a default subscription for a subscriber with more than one subscription.

Using my domain model its easy: Ask the topic for its subscriptions, and for each subscription - get the subscriber, see if its the default subscription and if so see how many subscriptions it has.

The problem is, with a large number of subscriptions / subscribers, this could be very very inefficient.

So Im trying to come up with an HQL query to solve it more efficiently (i.e, given a Topic, I get back the subscriptions which are the default subscriptions of their subscriber - which itself has more than one subscription).

It sounds quite tricky. Further, Im using MySql v4.0.x so I cant use subqueries.....

Does anyone have any pointers that might help?

Thanks,

Dave


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.