Lately, I have come across this Spring Data JPA repository method findWithBooksById
.
The two classes involved are very basic: Library one-to-many Books
, and the method is querying for a library and its books.
I looked at https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories.query-methods.details , but there is no reference to this method pattern (findWith...
).
Looking at the query generated, it queries the library table and queries books immediately after. So two queries are called consecutively like if I have called getBooks right after a findById
query (lazily initialized books in this case).
Does anyone know how findWith...
works in Spring Data JPA?