-->
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.  [ 3 posts ] 
Author Message
 Post subject: HQL query help
PostPosted: Thu Mar 17, 2005 9:06 pm 
Beginner
Beginner

Joined: Mon Jan 24, 2005 6:42 pm
Posts: 26
Hello,

Can someone help me with a hql query.

I have object A with a collection of B objects hanging off of it.

object B has an attribute attributeC

I need to get all objects A with corresponding object B such that
attributeC is a minimum.

Appreciate your help.


Top
 Profile  
 
 Post subject: why dont you give schema
PostPosted: Thu Mar 17, 2005 9:20 pm 
Newbie

Joined: Thu Mar 17, 2005 8:44 pm
Posts: 6
if you can give me little bit of sample schema or what you exactly trying to do.. i might help you


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 9:29 pm 
Beginner
Beginner

Joined: Mon Jan 24, 2005 6:42 pm
Posts: 26
Hibernfan,

Class A {

Set B = new HashSet();
}

Class B{
Integer attributeC
}


I need to retrieve all A objects and correspinding B object such that B object has a minimum value on attributeC out of all related B objects.

TABLE A
ID NAME
1 A


TABLE B
ID A_ID ATTRIBUTEC
10 1 5
11 1 6
12 1 10


I would get back A and B where B has ID 10 because 5 is the minimum of the 3.


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

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.