-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2단계 - Proxy #125
Open
yangseungin
wants to merge
5
commits into
next-step:yangseungin
Choose a base branch
from
yangseungin:step2
base: yangseungin
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
2단계 - Proxy #125
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
34247f9
test: 검증부 하드코딩으로 변경
yangseungin 748d297
refactor: OneToManyColumn을 재생성하지 않도록 변경
yangseungin 7fb4058
chore: 사용하지않는 메서드 정리
yangseungin 55fc069
refactor: 다수의 OneToMany를 처리할 수 있도록 변경
yangseungin 6f7997d
refactor: joinEntityclass를 상태로 저장하도록 변경
yangseungin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ | |
import persistence.sql.entity.EntityColumn; | ||
import persistence.sql.entity.EntityColumns; | ||
import persistence.sql.entity.EntityTable; | ||
import persistence.sql.entity.OneToManyColumn; | ||
|
||
import java.lang.reflect.Field; | ||
import java.util.Arrays; | ||
|
@@ -30,18 +29,20 @@ private String columnsClause(EntityColumns entityColumns, Object parentEntity) { | |
.collect(Collectors.toList()); | ||
|
||
if (parentEntity != null) { | ||
OneToManyColumn oneToManyColumn = new OneToManyColumn(findOneToManyField(parentEntity.getClass())); | ||
columns.add(oneToManyColumn.getForeignKeyColumnName()); | ||
List<Field> oneToManyFields = findOneToManyFields(parentEntity.getClass()); | ||
for (Field oneToManyField : oneToManyFields) { | ||
EntityColumn oneToManyColumn = EntityColumn.from(oneToManyField); | ||
columns.add(oneToManyColumn.getOneToManyColumn().getForeignKeyColumnName()); | ||
} | ||
} | ||
|
||
return String.join(", ", columns); | ||
} | ||
|
||
private Field findOneToManyField(Class<?> clazz) { | ||
private List<Field> findOneToManyFields(Class<?> clazz) { | ||
return Arrays.stream(clazz.getDeclaredFields()) | ||
.filter(field -> field.isAnnotationPresent(OneToMany.class)) | ||
.findFirst() | ||
.orElseThrow(() -> new RuntimeException("OneToMany 필드를 찾을 수 없습니다.")); | ||
.collect(Collectors.toList()); | ||
} | ||
Comment on lines
+42
to
46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여전히 이 행위는 ParentEntity 의 metadata 로 가져와 볼 수 있지 않을까요? |
||
|
||
private String valueClause(EntityColumns entityColumns, Object object, Long parentId) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,10 +86,10 @@ void insert2() throws SQLException { | |
List<OrderItem> selectResult = jdbcTemplate.query(selectQuery, new EntityRowMapper<>(OrderItem.class)); | ||
|
||
assertThat(selectResult).hasSize(2); | ||
assertThat(selectResult.get(0).getProduct()).isEqualTo(orderItem1.getProduct()); | ||
assertThat(selectResult.get(0).getQuantity()).isEqualTo(orderItem1.getQuantity()); | ||
assertThat(selectResult.get(1).getProduct()).isEqualTo(orderItem2.getProduct()); | ||
assertThat(selectResult.get(1).getQuantity()).isEqualTo(orderItem2.getQuantity()); | ||
assertThat(selectResult.get(0).getProduct()).isEqualTo("감자"); | ||
assertThat(selectResult.get(0).getQuantity()).isEqualTo(3); | ||
assertThat(selectResult.get(1).getProduct()).isEqualTo("고구마"); | ||
assertThat(selectResult.get(1).getQuantity()).isEqualTo(1); | ||
Comment on lines
+89
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 전 단계 피드백 반영해주셨네요 👍 |
||
|
||
jdbcTemplate.execute("drop table order_items"); | ||
jdbcTemplate.execute("drop table orders"); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그럼 매번 여기서 생성 할 필요 없을 것 같아요