java - Spring data jpa + joining 2 tables -
i have 2 entity classes product
, productaltid
no @onetomany
mapping defined between them.
i want this
select p productaltid inner join product pai p.id = pai.id
how can achieve this?
add method productaltid repository (choosing 1 because query returns productaltids):
@query("select pai productaltid pai " + "where pai.id in (select p.id product p)") list<productaltid> findforallproducts();
i switched aliases around, seem backward in example.
Comments
Post a Comment