diff --git a/docs/en/faq/how-can-i-see-the-generated-query.md b/docs/en/faq/how-can-i-see-the-generated-query.md index 75bd95f2d..89944d89d 100644 --- a/docs/en/faq/how-can-i-see-the-generated-query.md +++ b/docs/en/faq/how-can-i-see-the-generated-query.md @@ -4,7 +4,7 @@ Kotlin JDSL prints queries and parameters generated by DSL to the debug log. So Because the parameters contained in the log are printed through the `toString` function, it can be difficult to identify the values unless `toString` function is overridden. -``` +```kotlin select( path(Book::isbn), ).from( diff --git a/docs/en/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md b/docs/en/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md index c2494b6d9..f10a84a6e 100644 --- a/docs/en/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md +++ b/docs/en/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md @@ -2,21 +2,22 @@ Unlike jOOq and QueryDSL, Kotlin JDSL does not generate a `Metadata Model (code generation) for writing queries. -If you use code generation, you'll have to do the following. +If you use code generation, you'll have to do the following: ``` -Modify tables / entities → -Compilation errors due to code and metacode mismatch → -Temporarily change all code associated with the modified code, e.g. by commenting it out, to make it compile. -Regenerate code -Remove the temporary code that was processed to pass compilation and replace it with working code. +Modify tables and entities → +Entity modification causes compile errors → +Run Manven or Gradle task to regenerate the metadate → +Write query based on modified entity ``` -In addition, JPQL uses a string-based query writing method, so it can pass compilation but may cause errors when running the web application. +Then you might think about trying JPQL yourself, but that might not be a good idea. -However, Line-JDSL allows you to write queries based on pure code rather than using string-based writing and code generation. +JPQL uses a string-based way of writing queries, which makes it impossible to detect errors at compile time. -This means that as soon as you modify an entity or field name, it is reflected in the query code and can be compiled and executed. +However, the Kotlin JDSL uses code generation and pure code-based query construction rather than string-based construction. + +This means that as soon as you modify an entity or field name, it is reflected in the query code, and the above inconvenience does not exist. It also adopts an ORM-based object-oriented query like JPQL, which supports specifications such as polymorphism and fetch joins. diff --git a/docs/ko/faq/how-can-i-see-the-generated-query.md b/docs/ko/faq/how-can-i-see-the-generated-query.md index a7042c065..c7a5d5b23 100644 --- a/docs/ko/faq/how-can-i-see-the-generated-query.md +++ b/docs/ko/faq/how-can-i-see-the-generated-query.md @@ -4,7 +4,7 @@ Kotlin JDSL은 DSL를 통해 생성된 쿼리 및 파라미터를 debug 로그 로그에 포함된 파라미터의 경우 `toString` 함수로 출력되기 때문에 만약 `toString` 함수가 오버라이드 되지 않았다면 식별에 어려움이 있을 수 있습니다. -``` +```kotlin select( path(Book::isbn), ).from( diff --git a/docs/ko/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md b/docs/ko/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md index b1a30ae7d..f2f7cff62 100644 --- a/docs/ko/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md +++ b/docs/ko/faq/how-kotlin-jdsl-is-different-from-jooq-and-querydsl.md @@ -2,21 +2,22 @@ jOOq와 QueryDSL과 다르게 Kotlin JDSL의 경우 쿼리 작성을 위해 `Metadata Model(코드 제너레이션)`을 생성하지 않습니다. -코드 제너레이션 방식을 사용하면 다음과 같은 수고로움이 있습니다. +코드 제너레이션 방식을 사용하면 다음과 같은 수고로움이 있습니다: ``` -테이블 / 엔티티 수정 → -코드와 메타 코드 불일치로 인한 컴파일 에러 → -수정한 코드와 연관된 모든 코드를 컴파일이 동작하게끔 주석 처리등을 하여 임시로 변경 → -코드 재생성 → -컴파일 통과를 하기 위해 처리한 임시 코드를 지우고 정상 동작하는 코드로 변경 +테이블과 엔티티 수정 → +엔티티 수정으로 컴파일 오류 발생 → +메타데이터를 다시 생성하기 위해 Manven 또는 Gradle 작업 실행 → +수정된 엔티티를 기반으로 쿼리 작성 ``` -또 JPQL의 경우 문자열 기반의 쿼리 작성 방식을 사용하고 있기 때문에, 컴파일은 통과할 수 있지만 웹 어플리케이션 실행 시점에 오류가 발생할 소지가 있습니다. +그러면 아마도 우리는 JPQL을 생각해볼 수도 있지만 이는 좋은 생각이 아닐 수 있습니다. -하지만 Line-JDSL은 문자열 기반 작성과 코드 제너레이션 방식을 사용하는 것이 아닌 순수 코드 기반으로 쿼리 작성이 가능합니다. +JPQL은 문자열 기반의 쿼리 작성 방식을 사용하기 때문에, 컴파일 시점에 오류를 감지할 수 없습니다. -즉, 엔티티나 필드 이름을 수정하는 즉시 쿼리 코드에 반영이 되어 컴파일 및 실행 가능합니다. +하지만 Kotlin JDSL은 코드 제너레이션 방식과 문자열 기반 작성이 아닌 순수한 코드 기반으로 쿼리를 작성합니다. + +즉, 엔티티나 필드 이름을 수정하는 즉시 쿼리 코드에 반영이 되어 위와 같은 불편함이 존재하지 않습니다. 또 JPQL과 같이 ORM 기반의 객체지향 쿼리를 채택하고 있어서 다형성, Fetch 조인 등의 스펙을 지원합니다.