Pk Gupta
Pk Gupta

Reputation: 11

Spring data jpa join query using @query in repository

How to write join query using @query in spring data jpa without mapping (@oneToOne or manyToOne) between two entities class?

Upvotes: 1

Views: 3166

Answers (2)

Chris Savory
Chris Savory

Reputation: 2755

Have you tried using @Query(value = "", nativeQuery = true) ?

Upvotes: 0

user3151168
user3151168

Reputation:

Unfortunately this is not supported by JPA. Therefore Spring Data JPA can not join unrelated entities.

Hibernate 5.1 introduced explicit joins. You can leverage this feature by adding a custom repository implementation.

Upvotes: 1

Related Questions