I’m not very good in SQL and HQL…
I have two domains:
class Hotel {
String name
}
class Room {
Hotel hotel
float price
}
How many hotels have at least one room ?
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.
You probably want to make this a bi-directional relationship.
Then HQL:
Will return Hotels where the rooms collection has at least one value.
More details here.