Skip to content

Commit

Permalink
docs: reflect second reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
progress0407 committed Apr 25, 2024
1 parent 4a13287 commit 685c0e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ The simplest example is when you look up a column or entity without using DTO Pr

The table below shows some of the cases where nullable return types can occur when using the Kotlin JDSL.

| Item | Nullable or not | Reason |
|----------------|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| DTO Projection | X | Calling the constructor for all ROWs did not result in the object being created to allow nulls.<br/>Fields in DTO can be null, but DTO object cannot be null. |
| Column | O | Exists when looking up a field that is null. |
| Entity | O | Exists if the Entity being joined on Left Join is null. |
| Item | Nullable or not | Reason |
|----------------|-----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| DTO Projection | X | Because we're calling the constructor for all ROWs, the object is not created, resulting in a null-accepting result<br/>Fields in DTO can be null, but DTO object cannot be null. |
| Column | O | Exists when looking up a field that is null. |
| Entity | O | Exists if the Entity being joined on Left Join is null. |

As another example, the code below shows a situation where the Author entity exists, but the BookAuthor entity, the target of the left join, may be null.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Kotlin JDSL이 nullable한 반환 타입을 지원하는 이유는 JPQL 쿼리

아래 표는 Kotlin JDSL을 사용할 때 nullable한 반환 타입이 발생할 수 있는 몇 가지 경우를 나타냅니다.

| 항목 | null 여부 | 이유 |
|----------------|---------|-------------------------------------------------------------------------------------------------------|
| DTO Projection | X | 모든 ROW에 대한 생성자 호출하기 때문에 객체가 생성되어 null을 허용하는 결과가 나오지 않음<br/>DTO의 필드가 null일 수는 있으나 DTO 객체가 null일 수는 없음 |
| Column | O | null인 필드를 조회하는 경우 존재 |
| Entity | O | Left Join시 조인의 대상이 되는 Entity가 null인 경우 존재 |
| 항목 | null 여부 | 이유 |
|----------------|---------|--------------------------------------------------------------------------------------------------------|
| DTO Projection | X | 모든 ROW에 대한 생성자를 호출하기 때문에 객체가 생성되어 null을 허용하는 결과가 나오지 않음<br/>DTO의 필드가 null일 수는 있으나 DTO 객체가 null일 수는 없음 |
| Column | O | null인 필드를 조회하는 경우 존재 |
| Entity | O | Left Join시 조인의 대상이 되는 Entity가 null인 경우 존재 |

또 다른 예로 아래 코드는 Author 엔티티가 있지만, left join의 대상인 BookAuthor 엔티티는 null일 수 있는 상황을 보여줍니다.

Expand Down

0 comments on commit 685c0e8

Please sign in to comment.