๋ฐ˜์‘ํ˜•

JPA 2

[Springboot] JPA์™€ pageable ํ™œ์šฉํ•œ sort ์ •๋ ฌ ๊ตฌํ˜„ ๋ฐฉ๋ฒ•

Intro์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” spring boot ์—์„œ JPA์™€ pageable ํ™œ์šฉํ•œ sort ์ •๋ ฌ ๊ตฌํ˜„ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. user ๋ฐ์ดํ„ฐ๊ฐ€ ์žˆ๋‹ค๋Š” ๊ฐ€์ •ํ•˜์— ์ง„ํ–‰ํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.  1. User ์—”ํ‹ฐํ‹ฐ ์ •์˜ User ์—”ํ‹ฐํ‹ฐ์—๋Š” id, name, email, createdDate ๋“ฑ์˜ ํ•„๋“œ๊ฐ€ ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค.@Entitydata class User( @Id @GeneratedValue(strategy = GenerationType.IDENTITY) val id: Long, val name: String, val email: String, @CreatedDate val createdDate: LocalDateTime) 2. UserReposit..

[Springboot] JPA Projection ํ”„๋กœ์ ์…˜ ํ•˜๋Š” ๋ฐฉ๋ฒ•

Intro ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” Springboot ์Šคํ”„๋ง๋ถ€ํŠธ JPA์—์„œ ํ”„๋กœ์ ์…˜ ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Projection? ๋จผ์ € ๋“ค์–ด๊ฐ€๊ธฐ์— ์•ž์„œ ๊ฐ„๋‹จํ•˜๊ฒŒ ํ”„๋กœ์ ์…˜์— ๋Œ€ํ•œ ์˜๋ฏธ๋ฅผ ์‚ดํŽด๋ณผ๊ฒŒ์š”. ํ”„๋กœ์ ์…˜์€ ์—”ํ‹ฐํ‹ฐ์˜ ์†์„ฑ์ด ๋งŽ์„ ๋•Œ ์ผ๋ถ€ ๋ฐ์ดํ„ฐ๋งŒ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐฉ๋ฒ•์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๋” ์ž์„ธํ•œ ๋‚ด์šฉ์ด ๊ถ๊ธˆํ•˜์‹œ๋ฉด ์ผ์ „์— ์ œ๊ฐ€ ์ •๋ฆฌํ•ด๋†“์€ ํฌ์ŠคํŒ… ์ฐธ๊ณ  ๋ฐ”๋ž๋‹ˆ๋‹ค :) [MongoDB] ํ”„๋กœ์ ์…˜ (Projection) ์ด๋ž€? projection query ์‚ฌ์šฉ๋ฒ• How to do ์•„๋ž˜์˜ User domain ๊ฐ์ฒด๋ฅผ ์ฐธ๊ณ ํ•˜์—ฌ ์„ค๋ช…ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. @Document(collection = "user") class User( val userId: String?, val userName: String?, val user..

๋ฐ˜์‘ํ˜•