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.