问题
How to create a request for a complex query in JpaRepository
with the use of @Query
?
I am concerned about the relationships between entities. They may affect the preparation of the request.
Needed query SQL, my version @Query:
回答1:
Ok so more advisable way of declaring your query would be :
@Query( "SELECT bu.email " +
"FROM Businesscentr bu
INNER JOIN bu.bannersSet bs
INNER JOIN bs.clicks c " +
"WHERE c.fullNameClient = :fullNameClient" // optional
)
You only use the old join style when you have to join by non-primarykey values.
来源:https://stackoverflow.com/questions/41897719/how-to-create-a-request-for-a-complex-query-query-jpql-spring-jpa