Skip to content

4단계 - EntityEntryStep4 - #252

Open
dohoonkim023 wants to merge 5 commits into
next-step:dohoonkim023from
dohoonkim023:step4
Open

4단계 - EntityEntryStep4#252
dohoonkim023 wants to merge 5 commits into
next-step:dohoonkim023from
dohoonkim023:step4

Conversation

@dohoonkim023

Copy link
Copy Markdown

기능구현이 완료되어 리뷰요청 드립니다~ 리뷰 잘부탁드립니다 🙏

구현 중에 GONE 상태(Status)를 어떻게 활용할지 고민이 많았습니다.
GONE은 엔티티가 영속성 컨텍스트에서 더 이상 관리되지 않는 상태를 의미하는데,
이 경우 EntityEntry 객체의 상태를 GONE으로 변경하는 것이 과연 의미가 있을지 고민이 되었습니다.

이 부분에 대한 의견이나 조언 주시면 감사하겠습니다!

@wooobo wooobo self-assigned this Nov 12, 2024

@wooobo wooobo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

안녕하세요 도훈님!

4단계 잘 진행해주셨습니다.
코멘트 남겨 놓았어요~ 확인 후 재요청 부탁드립니다~

그럼 화이팅입니다!

public void clear() {
persistedEntities.clear();
public List<Object> getDeletedEntities() {
return entityEntries.values().stream().filter(e -> e.getStatus() == Status.DELETED).map(EntityEntry::getEntity)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return entityEntries.values().stream().filter(e -> e.getStatus() == Status.DELETED).map(EntityEntry::getEntity)
return entityEntries.values().stream().filter(e -> e.isDeleted().map(EntityEntry::getEntity)

객체에게 물어볼수 있겠네요 🤔

@@ -0,0 +1,10 @@
package persistence.entity;

public enum Status {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 경우 EntityEntry 객체의 상태를 GONE으로 변경하는 것이 과연 의미가 있을지 고민이 되었습니다.
이 부분에 대한 의견이나 조언 주시면 감사하겠습니다!

우선 도훈님의 의견도 궁금해서 아래 질문드려 볼께요!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case 1

func test() {
  em.persist(person1);
  em.flush();
  
  em.remove(person1);
  em.persist(person1); <=== (1)
  em.flush();
}

(1) persist 후 flush될때 어떤 흐름을 기대하시나요?

case 2

func test() {
  em.persist(person1);
  em.flush();

  em.remove(person1);
  em.flush();
  em.persist(person1); <=== (1)
}

(1) persist 후 어떤 결과를 기대하시나요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants