I am using Hibernate. I have the following SQL query. I have to convert it to criteria. How can I achieve it?
SELECT DISTINCT username
FROM usertable
WHERE user_id in (SELECT DISTINCT user_id FROM someother_table);
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This should do what you’re looking for if you’ve mapped “user_id” as property and didn’t map any relationships (if you did the right property might be “myEntity.user.id” instead of “myEntity.user_id”)