diff --git a/docs/en/jpql-with-kotlin-jdsl/spring-supports.md b/docs/en/jpql-with-kotlin-jdsl/spring-supports.md index bb6b60c43..3e63b848c 100644 --- a/docs/en/jpql-with-kotlin-jdsl/spring-supports.md +++ b/docs/en/jpql-with-kotlin-jdsl/spring-supports.md @@ -12,23 +12,33 @@ If you declare your `JpqlSerializer` or `JpqlIntrospector` as a bean, it will be If your `JpaRepository` extends `KotlinJdslJpqlExecutor`, you can use the extension provided by Kotlin JDSL. ```kotlin -interface AuthorRepository : JpaRepository, KotlinJdslJpqlExecutor interface BookRepository : JpaRepository, KotlinJdslJpqlExecutor -authorRepository.findAll { +val result: List = bookRepository.findAll { select( - path(Author::authorId), + path(Book::isbn), + ).from( + entity(Book::class), + ) +} + +val result: Page = bookRepository.findPage(pageable) { + select( + path(Book::isbn), ).from( - entity(Author::class), - join(BookAuthor::class).on(path(Author::authorId).equal(path(BookAuthor::authorId))), - ).groupBy( - path(Author::authorId), - ).orderBy( - count(Author::authorId).desc(), + entity(Book::class), + ) +} + +val result: Slice = bookRepository.findSlice(pageable) { + select( + path(Book::isbn), + ).from( + entity(Book::class), ) } -bookRepository.findPage(pageable) { +val result: Stream = bookRepository.findStream { select( path(Book::isbn), ).from( diff --git a/docs/ko/jpql-with-kotlin-jdsl/spring-supports.md b/docs/ko/jpql-with-kotlin-jdsl/spring-supports.md index b33b4930d..b32228d16 100644 --- a/docs/ko/jpql-with-kotlin-jdsl/spring-supports.md +++ b/docs/ko/jpql-with-kotlin-jdsl/spring-supports.md @@ -12,23 +12,33 @@ Kotlin JDSL은 Spring Boot AutoConfigure를 지원합니다. 만약 사용하고 있는 `JpaRepository`가 `KotlinJdslJpqlExecutor`를 상속하면, Kotlin JDSL이 제공하는 확장 기능을 사용할 수 있습니다. ```kotlin -interface AuthorRepository : JpaRepository, KotlinJdslJpqlExecutor interface BookRepository : JpaRepository, KotlinJdslJpqlExecutor -authorRepository.findAll { +val result: List = bookRepository.findAll { select( - path(Author::authorId), + path(Book::isbn), + ).from( + entity(Book::class), + ) +} + +val result: Page = bookRepository.findPage(pageable) { + select( + path(Book::isbn), ).from( - entity(Author::class), - join(BookAuthor::class).on(path(Author::authorId).equal(path(BookAuthor::authorId))), - ).groupBy( - path(Author::authorId), - ).orderBy( - count(Author::authorId).desc(), + entity(Book::class), + ) +} + +val result: Slice = bookRepository.findSlice(pageable) { + select( + path(Book::isbn), + ).from( + entity(Book::class), ) } -bookRepository.findPage(pageable) { +val result: Stream = bookRepository.findStream { select( path(Book::isbn), ).from(