The following is the mySQL query that I use to retrieve HolidayPackages for a given Hotel
:
SELECT pkg.idHolidayPackage, pkg.name FROM holidaypackage pkg INNER JOIN holidaypackagehotel hph ON pkg.idHolidayPackage = hph.idHolidayPackage INNER JOIN hotelroom hr ON hr.idHotelRoom = hph.idHotelRoom WHERE hr.idHotel = 1;
I have a POJO with mapping for:
- Holidaypackage
- Hotel
- hotel room
I do not have a POJO for the HolidayPackageHotel
.
Can I use the criteria API or HQL to execute an SQL query without creating a POJO for the HolidayPackageHotel?
For curiosity, the DB relationship:
source share