Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用JPA/Criteria编写不存在的查询_Jpa_Jpa 2.0_Criteria Api - Fatal编程技术网

使用JPA/Criteria编写不存在的查询

使用JPA/Criteria编写不存在的查询,jpa,jpa-2.0,criteria-api,Jpa,Jpa 2.0,Criteria Api,我正在运行一个模拟销售机票的应用程序。 使用简单模式(1-n): 我想使用JPAAPI或Criteria生成一个查询,它为我提供了所有可用座位的列表。即,预订表中不存在(未预订)的所有座位对象。(SEAT.id\u SEAT=BOOKING.id\u SEAT) 谁能给我一个线索,哪一个是产生这样一个查询的最佳选择 select seat from Seat seat where seat.id not in ( select seat2.id from Booking booking

我正在运行一个模拟销售机票的应用程序。
使用简单模式(1-n):

我想使用JPAAPI或Criteria生成一个查询,它为我提供了所有可用座位的列表。即,预订表中不存在(未预订)的所有座位对象。(
SEAT.id\u SEAT=BOOKING.id\u SEAT

谁能给我一个线索,哪一个是产生这样一个查询的最佳选择

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