-->
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.  [ 2 posts ] 
Author Message
 Post subject: Is it possible to add criteria to join clause?
PostPosted: Mon Dec 27, 2004 5:45 am 
Newbie

Joined: Fri Dec 24, 2004 4:09 am
Posts: 11
I have following tables and corresponding classes with appropriate get/set methods for all fields.

ITEMS
ID

ORDER
ID
ITEM_ID
CUSTOMER_ID

class Item{
privater long id;
private Set orders;
...
}

class ORDER{
privater long id;
private Item item;
private long customer_id;
...
}


Could anyone suggest a HQL query that selects all items that have no orders for given customer_id?

SQL query for this looks like

SELECT ITEMS.* FROM ITEMS LEFT JOIN ORDERS ON ITEMS.ID=ORDERS.ITEM_ID AND (ORDERS.CUSTOMER_ID = ? ) WHERE (ORDERS.ITEM_ID IS NULL) ;


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 27, 2004 6:37 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
On thread is enough. Posting this stuff multiple times won't give you more answers.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.