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: Criteria for JDO example
PostPosted: Sun Aug 21, 2005 11:51 pm 
Newbie

Joined: Sat Nov 01, 2003 12:35 pm
Posts: 11
Hi,
I am studing the persistence frameworks JDO and Hibernate. Acutally, I have used Hibernate in 2 projects. For JDO, I do not use it in real project yet because no really good open source solution for it. When studying JDO specification, there is a query example in it shown below:

"(emps.contains(e1) & e1.dependents > 1) &
(emps.contains(e2) & (e2.salary > 30000 & e1 != e2))"

which means "find deparments wehre there exists an employee with more than 1 dependent and an employee making more than 30,000, and there are 2 different employees satisfying the two conditions"

I am trying to translate this JDO query to Hibernate's criteria query. But I get problem in trnaslating the e1 != e2 expression. Any of you have know how to translate this part?

My current translation is like

sess.createCriteria(Department.class)
.createCriteria("emps")
.add(Restrictions.or(Restrictions.gt("dependents", 1), Restrictions.gt("salary", 3000))
) ....


Rice


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 22, 2005 3:44 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
e1.id <> e2.id


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.