1

I have problem with converting an existing SQL statment to a JPQL statement.

SQL statement is:

select SeatsID from cinema.seats a 
where a.SeatsID not in 
    (select SeatID FROM cinema.reservation_seats s, cinema.reservation r 
    where s.ReservationID = r.ReservationID and r.ShowID = 1)

Which finds all free seats for show with ID = 1. But I can not properly write JQPL statement.

Could you help me?

Unheilig
  • 16,196
  • 193
  • 68
  • 98
  • 4
    What do you mean by "*Properly*"? A JPQL statement refers to entities and properties/fields in them. I don't think `cinema` is actually an entity and `reservation_seats` is one of the properties in the `cinema` entity (as they should be `Cinema` and `reservationSeats` respectively following the basic Java naming conventions). You appear to attempt to refer to the underlying database tables and columns in the JPQL. – Tiny May 16 '15 at 04:39
  • 3
    What makes you want to write that with JPQL in the first place? Severe pain and suffering are the consequences of wanting to solve SQL problems with JPQL. – Lukas Eder May 16 '15 at 06:50
  • 2
    JPQL caters for many many situations. It doesn't cater for all. But then there is nothing in the posted question that suggests this is not doable with JPQL. Just that the OP doesn't present any entities or what they have tried. SQL also is a cause of pain and suffering – Neil Stockton May 16 '15 at 07:22
  • @NeilStockton: Fair enough ;) – Lukas Eder May 16 '15 at 10:16

0 Answers0