-
Nov 30th, 2007, 12:29 AM
#1
Convert SQL to Hibernate Criteria
Hi Experts
My self Ceezane and I am a new member of this forum.
Will you pls help me to convert below mentioned SQL Query into Hibernate Criteria API.
>>>
select * from main_product_group_masterfile
where mpgcode in(select dfranmpg from dealer_franchise_file where dfrandid=330 and dfranmpg not in
(select mpg from mpg_restriction_file where dealer_id=330 and user_id='SEC'))
<<<
Actually, I want to use Criteria API for subquery.
Please suggest.
Thanks.....
Ceezane
-
Nov 30th, 2007, 09:23 PM
#2
This depends on your mapping. SQL works on tables, Hibernate works on objects. Usually you don't have a one-to-one mapping between tables and objects. Besides that you find nearly every keyword also in Hibernate's criteria API. The way to us it is via the static methods in Restrictions class like in Restrictions.in(..) or Restrictions.not(..).
Joerg
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules