2012-11-17 2 views
0

항공기 비행기 티켓을 판매하는 응용 프로그램을 실행 중입니다. 간단한 스키마 (1-N)를 사용하여
는 :
JPA/Criteria를 사용하여 NON-EXIST 쿼리 작성하기

SEAT 
------ 
id_seat 
description 
position 

BOOKING 
--------- 
id 
customer 
id_seat 

나는 나에게 가능한 모든 좌석의 목록을 제공 JPA API 또는 기준을 사용하여 쿼리를 생성하고 싶습니다. 즉, BOOKING 테이블에 존재하지 않는 (예약되지 않은) 모든 SEAT 객체. (SEAT.id_seat = BOOKING.id_seat)

누구나 내게 그런 쿼리를 생성하는 데 가장 유용한 옵션을 제공 할 수 있습니까?

답변

1
select seat from Seat seat 
where seat.id not in (
    select seat2.id from Booking booking 
    inner join booking.seat seat2) 
+0

도움 주셔서 감사합니다. –

관련 문제