-->
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: Universal quantifier (forall) using criteria
PostPosted: Thu Sep 18, 2008 1:22 pm 
Newbie

Joined: Thu Sep 18, 2008 1:05 pm
Posts: 3
Hi, is there any way to simulate universal quantifier (for all) using criteria? E.g. I have object Employee and Task in OneToMany association.

Employee 1 ----- * Task

Task has status attribute. I would like to select all Employees, which have all their tasks in status DONE.

Easiest way to do this is rewrite FORALL Condition to NOT EXISTS (NOT Condition) which can be written in SQL:


select * from employee where not exists (select * from task where task.employee_id = employee.id and (task.status <> 'DONE'))

This is easy in SQL but I want to use Criteria. I tried Subqueries.exists and always got an Exception. If it is possible I don't want to use exists quantifier because it executes select for every employee.

Is there any way how to select all Employees, which have all their tasks in status DONE, the best without using subqueries.

Thanks


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.