Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Criteria with IN clause that comes from a sub sql

Dheeman Basu
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I create IN Restriction using sub query?

Here are my tables
Table A ( primary_key_a, vala1, vala2, ....... )
Table B ( primary_key_b, foreign_key_a, valb1, valb2, ..........)

I want to select records from table B ( mapped in hibernate by BeanB) with certain foreign_key_a values ( say the ones with vala1 = 5, select primary_key_a where vala1 = 5)

My Hibernate code:
Session session = sessionFactory.openSession();
Criteria crit = session.createCriteria(BeanB.class); "foreign_key_a" <some code> );

How do I fit in select primary_key_a where vala1 = 5 for <some code> ?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic