-->
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 on collection size & elements min-max values
PostPosted: Fri Mar 17, 2006 12:17 pm 
Newbie

Joined: Fri Mar 17, 2006 11:32 am
Posts: 1
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3

Name and version of the database you are using: 10g

I am having problem to apply these 2 criterias (Collection's size & Collection elements' min-max) together.
I can apply Collection-Size in HQL-Query, but unable to get it to work in Criteria.
Also, applying the min-max on Collecion elements, I can get it to work in Criteria, but not in HQL-Query.

// Both Collections must be filled: Does not work, tried isEmtpy() as well.
qCriteria.add( Restrictions.and( Restrictions.sizeGt("imprint_1_runs", 0), Restrictions.sizeGt("imprint_2_runs", 0)
) );

// Then, min & max on Collecion elements
/* Works in HQL-Criteria */
qCrit.createCriteria("production_tags").add(
Restrictions.and(
Restrictions.between( "tag_width", tagWidthMin, tagWidthMax),
Restrictions.between( "tag_length", tagLengthMin, tagLengthMax) )
);

/* does not work in HQL-Query */
qryStr = " ( ";
qryStr += "( all elements(q.production_tags.tag_width) between " + tagWidthMin + " and " + tagWidthMax + ")";
qryStr += " and ";
qryStr += " ( all elements(q.production_tags.tag_length) between " + tagLengthMin + " and " + tagLengthMax + ")";
qryStr += " ) ";

How these 2 conditions can fit into either HQL-Query or Criteria ?
Please help. Thanks a lot.


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.