-->
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: Criteria API - Property.in()
PostPosted: Thu Jul 01, 2010 5:22 am 
Newbie

Joined: Thu Jul 01, 2010 4:36 am
Posts: 4
Hi hibernate users!
I am developing a multi-criteria search page (somethign like http://www.devx.com/Java/Article/28754/ ... portItem=1), and I use Hibernate's org.hibernate.Criteria class to construct the filtration. Now I need to do something like this:

SELECT * FROM table1 JOIN table2 ON table1.col1=table2.col2
WHERE table2.colA='abc'
AND 'abc' IN (
SELECT col3 FROM table3 WHERE ....
)

Note that at the 'IN' clause, I use a string value (abc) instead of a table field.

Now, Hibernate provides this:
org.hibernate.criterion.Property.in(Collection values)

But the problem is, this method in() can only be called from the Property class (which represents a table field). But I don't want to filter any field by using the IN operator. I just want to make sure that the string value (abc) exists in table3.

Is it possible to do this using Hibernate's Criteria API?

Hope you would help.
Thank you!



Best Regards
Will Sumekar


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.