I am a new to Spring Data JPA
, wanted to know how do I write the following subquery:
select o from Owner o where o.ownerId IN (Select c.ownerId from Cars c)
Here Owner
is one entity class and Cars
is another entity class and I'll be having two repositories one as OwnerRepository
and the other as CarRepository
, both extending JPARepository
.
Help needed in writing this sort of custom queries with IN
operator.
Thanks in advance.