Skip to content
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

๐Ÿš€ 4๋‹จ๊ณ„ - EntityEntry #257

Open
wants to merge 2 commits into
base: sang5c
Choose a base branch
from

Conversation

sang5c
Copy link

@sang5c sang5c commented Nov 21, 2024

์•ˆ๋…•ํ•˜์„ธ์š” ๋ฆฌ๋ทฐ์–ด๋‹˜!

์–ด๋–ค ๋ฐฉํ–ฅ์œผ๋กœ ๋ฏธ์…˜์„ ์ˆ˜ํ–‰ํ•˜๋ฉฐ ํ’€์–ด๋‚˜๊ฐ€์•ผ ํ• ์ง€ ๋ชฐ๋ผ ํžŒํŠธ๋ฅผ ์–ป๊ณ ์ž ์ผ๋‹จ PR์„ ์˜ฌ๋ ค๋ด…๋‹ˆ๋‹ค..!

EntityEntry๊ฐ€ ์–ธ์ œ ์–ด๋–ป๊ฒŒ ์“ฐ์—ฌ์•ผ ์ข‹์„์ง€ ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค.
ํ˜„์žฌ ์ƒํƒœ์—์„œ ์–ด๋–ค ๋ถ€๋ถ„์„ ๊ณ ๋ฏผํ•˜๋ฉด์„œ ๊ตฌํ˜„ํ•˜๋ฉด ์ข‹์„์ง€ ํžŒํŠธ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค ๐Ÿ™

Copy link

@wooobo wooobo left a comment

Choose a reason for hiding this comment

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

์•ˆ๋…•ํ•˜์„ธ์š” ์ƒ์˜ค๋‹˜~

4๋‹จ๊ณ„ ๊นŒ์ง€ ์ž˜์˜ค์…จ์Šต๋‹ˆ๋‹ค ๐Ÿค™
์ฝ”๋ฉ˜ํŠธ๋‚จ๊ฒจ ๋†“์•˜๋Š”๋ฐ ๋„์›€์ด ๋˜์—ˆ์œผ๋ฉด ์ข‹๊ฒ ๋„ค์š”~

๊ทธ๋Ÿผ ํ™”์ดํŒ…์ž…๋‹ˆ๋‹ค!

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

public class EntityEntry {
Copy link

Choose a reason for hiding this comment

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

JPA๊ฐ€ ๋Œ์•„๊ฐ€๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ธ๊ณ„ ์™€ ์‹ค์ œ DB ์„ธ๊ณ„ ๋Š” ๋‹ค๋ฅธ๊ณณ์— ์žˆ์ฃ ?
์ด๋Ÿฌํ•œ ๋‹ค๋ฅธ ๋‘๊ฐœ์˜ ์„ธ๊ณ„๋ฅผ Entity ๊ฐ์ฒด๋ผ๋Š” ๊ฐœ๋…์„ ํ†ตํ•ด ์•ˆ์ „ํ•˜๊ณ  ํšจ์œจ์ ์œผ๋กœ ๊ด€๋ฆฌํ•ด์ฃผ์–ด์•ผํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿผ, JPA์˜ Entity(์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜)์„ DB๋กœ ๋™๊ธฐํ™” ํ•˜๋Š”๋ฐ ์‹œ๊ฐ„์ด ๊ฑธ๋ฆด์ˆ˜๋„ ์žˆ์„๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿผ ์šฐ๋ฆฌ๋Š” ๋Œ€๊ธฐํ•ด์•ผํ•˜๊ณ  Entity์— ๋Œ€ํ•œ ์ ‘๊ทผ์„ ์ œ์•ˆํ•˜์—ฌ ์˜จ์ „ํ•œ ๋™๊ธฐํ™” ๊ณผ์ •์„ ์ด๋ฃจ์–ด์ง€๊ฒŒ ํ•ด์•ผ ํ•  ๋“ฏํ•ฉ๋‹ˆ๋‹ค.

Copy link

Choose a reason for hiding this comment

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

  1. EntityEntry๋Š” ๊ฐ ์—”ํ‹ฐํ‹ฐ์˜ ์ƒํƒœ๋ฅผ ์ถ”์ ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ
  2. ์˜์†ํ™”๋œ Entity์˜ ์ƒํƒœ๋ฅผ ๊ฐ€์ง€๋ฏ€๋กœ์จ
    • MANAGED โ†’ DELETED๋Š” ํ—ˆ์šฉ๋˜์ง€๋งŒ MANAGED โ†’ GONE์€ ํ—ˆ์šฉํ•˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Œ.
    • GONE -> MANAGED ํ—ˆ์šฉํ•  ์ˆ˜ ์—†์Œ
      • ์ด์œ ๊ฐ€ ๋ญ˜๊นŒ์š”?

Copy link

Choose a reason for hiding this comment

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

๊ทธ๋ ‡๋‹ค๋ฉด, EntityEntry๋Š” Entity๋งˆ๋‹ค ์ƒํƒœ๋ฅผ ๊ด€๋ฆฌํ•ด์ฃผ๋ฉด ์ข‹์„๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. EntityEntry๊ฐ€ Entity์˜ ์‹๋ณ„์ž๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ์–ด์•ผํ•˜๋Š” ์ด์œ ๊ฐ€ ๋ ์ˆ˜ ์žˆ๊ฒ ๋„ค์š”.

๊ฐœ์ธ์ ์ธ ์ƒ๊ฐ์œผ๋ก  EntityEntry ๋Š” ์–ด๋–คํ™˜๊ฒฝ์œผ๋กœ ๊ตฌ์ถ•๋ฐฉํ–ฅ์„ ์žก๋Š๋ƒ์— ๋”ฐ๋ผ ๋‹ค๋ฅด๋‹ค๊ณ  ์ƒ๊ฐํ•ด์š”~ ์ฝ”๋ฉ˜ํŠธ๋Š” ์ฐธ๊ณ  ์ •๋„๋กœ ๋ด์ฃผ์„ธ์š”~

๋ชจ๋“  ์ƒํƒœ๋ฅผ ๋‹ค ์ ์šฉํ•˜์‹ค ํ•„์š”๋Š” ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. ์ค‘์š”ํ•œ๊ฒƒ์€ ์ƒ์˜ค๋‹˜๋งŒ์˜ ์ƒ๊ฐ์œผ๋กœ ๊ฐœ๋…์„์ดํ•ดํ•˜๋Š”๊ฒƒ์ž…๋‹ˆ๋‹ค.

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