我有以下查询在MySQL中完美运行但是当我在存储库中编写时它会出错我如何在JPARepository
中编写内连接查询?
@Query("Select address from Address a inner join Order o ON a.id=o.pickup_address_id where o.customer_id=: customerId AND a.address LIKE 'C%'")
Set<Address> findPickupAddress(@Param("customerId") Long customerId);
错误:意外令牌:在第1行第66列附近订购
答案 0 :(得分:0)
order
是保留字。如果你不能重命名表,你应该使用它:
@Query("Select address from Address a inner join `Order` o ON ...")
答案 1 :(得分:0)
JPQL中没有 @Query("Select a from Address a , Order o where a.id=o.pickupAddress AND o.customer.id=:customerId AND a.address LIKE 'C%'")
Address findPickupAddress(@Param("customerId") Long customerId);
}
,因此查询更新为:
AVPlayerController