728x90
๋ฐ˜์‘ํ˜•
์Šคํ”„๋ง ๋ฐ์ดํ„ฐ JPA - Custom Repository Best Practice

์‚ฌ์šฉ์ž ์ •์˜ Repository Best Practice ์‚ฌ์šฉ์ž ์ •์˜ Repository๋ฅผ ๋งŒ๋“ค ๋•Œ ๊ฐ€์žฅ ์ข‹์€ ๋ฐฉ๋ฒ•์„ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. ์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉ์ž ์ •์˜ Repository๋ผ๊ณ  ํ•จ์€, JpaRepository๋ฅผ ์ƒ์†ํ•ด์„œ ์ฟผ๋ฆฌ ๋ฉ”์„œ๋“œ๋ฅผ ์ด์šฉํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ผ ๊ตฌํ˜„์ฒด์—์„œ ์ง์ ‘ JPA๋ฅผ ์‚ฌ์šฉํ•˜๊ฑฐ๋‚˜ MyBatis, JdbcTemplate, QueryDSL ๋“ฑ์„ ์ด์šฉํ•ด ๊ตฌํ˜„ํ•œ ๊ฒƒ์„ ๋งํ•ฉ๋‹ˆ๋‹ค. ์ƒ๋Œ€์ ์œผ๋กœ(?) ๋‚˜์œ ์˜ˆ์‹œ Entity๊ฐ€ Member, Team์ด ์กด์žฌํ•˜๊ณ  Member๋Š” JpaRepository๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  Team์€ ์‚ฌ์šฉ์ž ์ •์˜ Repository๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•˜๋ฉด ๊ทธ๋ƒฅ ๊ตฌํ˜„ํ•ด๋„ ์ƒ๊ด€์—†์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ MemberRepository๊ฐ€ ์กด์žฌํ•˜๋Š”๋ฐ CustomMemberRepository๋ฅผ ๋”ฐ๋กœ ๋งŒ๋“ค์–ด์„œ S..

JPA 2021. 7. 7. 09:42
728x90
๋ฐ˜์‘ํ˜•
๊ณต์ง€์‚ฌํ•ญ
Total
83,839
Today
59
Yesterday
439
๋งํฌ
«   2022/07   »
์ผ ์›” ํ™” ์ˆ˜ ๋ชฉ ๊ธˆ ํ† 
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
๊ธ€ ๋ณด๊ด€ํ•จ