-->
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: Hibernate in Action p. 264, how to change the criteria...
PostPosted: Tue Oct 19, 2004 9:27 am 
Newbie

Joined: Tue Oct 19, 2004 9:22 am
Posts: 2
I would like to know how I should change the criteria at the page 264 to retrieve all the Items that do not have any Bids or have bids under 100$?

The mapping between item and bid is one-to-many and the criteria given in p. 264 is

List results = session.createCriteria(Item.class)
.add( Expression.like("description", "gc", MatchMode.ANYWHERE) )
.createCriteria("bids")
.add( Expression.gt("amount", new BigDecimal("100") ) )
.list();

I am specially interested how to test if parent in one2many relation does not have any children.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 19, 2004 5:59 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
there is no support for subselects in the criteria query API at this time, so you could use Expression.sql().

I am +1 on adding a new Expression.empty() criterion, so please add a request for this to JIRA. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 21, 2004 3:29 am 
Newbie

Joined: Tue Oct 19, 2004 9:22 am
Posts: 2
Feature request added to the JIRA


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.