์คํ๋ง ์บ์(Spring Cache)์์ฃผ ์ฌ์ฉ๋๋ ๋ฐ์ดํฐ๋ฅผ ์บ์ ๋ฉ๋ชจ๋ฆฌ์ ์ ์ฅํ์ฌ ๋น ๋ฅธ ๊ฒ์์ ๊ฐ๋ฅํ๊ฒ ํจ build.gradleimplementation 'org.springframework.boot:spring-boot-starter-cache Spring Boot Cache ์ด๋
ธํ
์ด์
@EnableCachingSpring Boot Cache๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด ‘์บ์ ํ์ฑํ’๋ฅผ ์ํ ์ด๋
ธํ
์ด์
์ ์๋ฏธํ๋ค@CacheConfig์บ์์ ๋ณด๋ฅผ ‘ํด๋์ค ๋จ์’๋ก ์ฌ์ฉํ๊ณ ๊ด๋ฆฌํ๊ธฐ ์ํ ์ด๋
ธํ
์ด์
์ ์๋ฏธํ๋ค@Cacheable์บ์์ ๋ณด๋ฅผ ๋ฉ๋ชจ๋ฆฌ ์์ ‘์ ์ฅ’ํ๊ฑฐ๋ ‘์กฐํ’ํด์ค๋ ๊ธฐ๋ฅ์ ์ํํ๋ ์ด๋
ธํ
์ด์
์ด๋ค@CachePut์บ์ ์ ๋ณด๋ฅผ ๋ฉ๋ชจ๋ฆฌ์์ ‘์ ์ฅ’ํ๋ฉฐ ์กด์ฌ ์ ๊ฐฑ์ ํ๋ ๊ธฐ๋ฅ์ ์ํํ๋ ์ด๋
ธํ
์ด์
์ด๋ค@CacheEv..
Spring
https://zzang9ha.tistory.com/399 Spring Boot SQL ์ค์ (hibernate, logging) ๐ Spring Boot SQL ์ค์ (hibernate, logging) ์๋
ํ์ธ์, Spring Boot์ hibernate SQL ์ค์ ์ ๋ํด ์ดํด๋ณด๊ฒ ์ต๋๋ค. ์ค์ ์ด์์ ํ๋ค๋ณด๋ฉด ์ํ๋ ์ฟผ๋ฆฌ๋ฌธ์ ๋ํด ํ์
ํ๊ณ , DB์์ ๊ฒฐ๊ณผ๊ฐ์ ํ์ธํ๊ณ ์ถ์๋๊ฐ zzang9ha.tistory.com
https://sewonlog.tistory.com/27 [JPA] Cannot call sendError() after the response has been committed ๐โ๏ธ๋ด๊ฐ ์ํ๋ ๊ฒฐ๊ณผ ๊ทธ๋ฃน์ ์กฐํํ ํ ๊ทธ๋ฃน์ ํฌํจ๋ ๋ฉค๋ฒ๋ค์ ์ค์ฒฉ json์ผ๋ก ์ถ์ถํ๋ ค๊ณ ํ์ ๊ทธ๋ฃน ์ํฐํฐ์ ๋ฉค๋ฒ ๋ฆฌ์คํธ ํ๋๋ฅผ ์ถ๊ฐํ ํ `@OneToMany` ์์ฑ์ ์ถ๊ฐํ๊ณ , ๋ฉค๋ฒ ์ํฐํฐ์ ์ sewonlog.tistory.com ์ด ๋ฌธ์ ๋ฅผ @JsonIgnore๋ก ํด๊ฒฐํ๋ ค๊ณ ํ์ง๋ง ,,, ๋ค๋ฅธ ๋ฌธ์ ์ฌํญ์ด ์์ด์ ์คํจ ์ํ ์ฐธ์กฐ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํ ๋ฐฉ๋ฒ 1. `@JsonIgnore` : json ๋ฐ์ดํฐ์ ํด๋น ํ๋กํผํฐ๋ null๋ก ๋ค์ด๊ฐ๊ฒ ๋๋ฉฐ, ๋ฐ์ดํฐ์ ํฌํจ๋์ง ์์ 2. `@JsonManagedReference`..
ํค๋ ์คํ์ผ ์์ฑ CellStyle headerCellStyle = sheet.getWorkbook().createCellStyle(); headerCellStyle.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex()); // ๋ฐฐ๊ฒฝ์ ์ค์ headerCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); Font headerFont = sheet.getWorkbook().createFont(); headerFont.setBold(true); // ํฐํธ ๊ตต๊ธฐ ์ค์ headerCellStyle.setFont(headerFont); Row headerRow = sheet.createRow(0); for..

๐คทโ๏ธQueryDSL ์ด๋? ํ์ด๋ฒ๋ค์ดํธ ์ฟผ๋ฆฌ ์ธ์ด(HQL: Hibernate Query Language)์ ์ฟผ๋ฆฌ๋ฅผ ํ์
์ ์์ ํ๊ฒ ์์ฑ ๋ฐ ๊ด๋ฆฌํด์ฃผ๋ ํ๋ ์์ํฌ ์ ์ ํ์
์ ์ด์ฉํ์ฌ SQL๊ณผ ๊ฐ์ ์ฟผ๋ฆฌ๋ฅผ ์์ฑํ ์ ์๊ฒ ํด์ค ์๋ฐ ์ฝ๋๋ก SQL๋ฌธ์ ์์ฑํ ์ ์์ด์ ์ปดํ์ผ ์์ ์ค๋ฅ๋ฅผ ๋ฐ์ํ์ฌ ์๋ชป๋ ์ฟผ๋ฆฌ๊ฐ ์คํ๋๋ ๊ฒ์ ๋ฐฉ์งํ ์ ์๋ค. ๐ฑ์ฝ๋์ ์ ์ฉํ๊ธฐ - maven pom.xml ์์กด์ฑ ์ถ๊ฐ com.querydsl querydsl-jpa 5.0.0 com.querydsl querydsl-apt 5.0.0 querydsl-apt apt(annotation processing tool)์ด๊ณ @Entity๋ก ํ์๋ ๊ฐ์ฒด๋ค์ Q-type ์ํฐํฐ ํด๋์ค๋ก ์์ฑํด์ค๋ค. plugin ์ค์ com.mysema..
JPA๊ฐ ์ ๊ณตํ๋ DB ๊ธฐ๋ณธ ํค ํ ๋น ์ ๋ต์ ์ง์ ํ ๋น ๋ฐฉ์, ์๋ ์์ฑ ๋ฐฉ์ 2๊ฐ์ง๊ฐ ์๋ค. โ๏ธ์ง์ ํ ๋น ๋ฐฉ์ ํ๋์ @Id ์ด๋
ธํ
์ด์
์ ์ฌ์ฉํด์ฃผ๋ฉด ๋๋ค. @Id private int userNo; @Column ์ด๋
ธํ
์ด์
์ ๊ฐ ํ๋ ์์ ๋ถ์ฌ์ ์ปฌ๋ผ๋ช
์ ๋ฐ๋ก ์ง์ ํ์ง ์์ผ๋ฉด JPA๊ฐ ์์์ camelCase๋ก ์์ฑ๋ ํ๋๋ช
์ snake_case๋ก ์์ฑ๋ ํ
์ด๋ธ ์ปฌ๋ผ๊ณผ ๋งคํ์์ผ์ค๋ค. @Column(name = "user_id") private String userId; (camelCase)userId (snake_case)user_id ํด๋น ์ ๋ต์ Application์์ ์ง์ ๊ธฐ๋ณธ ํค๋ฅผ ํ ๋นํด์ฃผ์ด์ผ ํ๋ค! โ๏ธ์๋ ์์ฑ ๋ฐฉ์ @Id์ @GeneratedValue๋ฅผ ์ฌ์ฉํด์ค๋ค. 4๊ฐ์ง ๋ฐฉ์์ด ์กด์ฌํจ(..
JPA๋ update ๋ฉ์๋๋ฅผ ๋ฐ๋ก ๊ตฌํํ์ง ์๊ณ save ๋ฉ์๋๋ฅผ ํตํด ์ ์ฅ๊ณผ ๋ณ๊ฒฝ์ ๋ํ ๊ธฐ๋ฅ์ ํ๋ฒ์ ์ ๊ณตํ๊ณ ์์ ๋ํฐ ์ฒดํน(Dirty Checking) ์ด๋? ์ํฐํฐ ๋งค๋์ ๊ฐ ๋ณ๊ฒฝ์ด ๋ฐ์ํ ์ํฐํฐ๋ฅผ ์๋ ๊ฐ์งํ์ฌ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๋ฐ์ํ๋ ๊ฒ์ ๋งํ๋ค. Dirty Checking์ ์ด๋ฏธ ์์ํ ๋ ์ํฐํฐ๋ค์ ๋์์ผ๋ก ์๋ํจ ๋ํฐ ์ฒดํน์ด ์ผ์ด๋๋ ํ๊ฒฝ์ ์๋ ๋๊ฐ์ง ์กฐ๊ฑด์ด ์ถฉ์กฑ ๋์ด์ผ ํจ ์์ ์ํ(Managed) ์์ ์๋ ์ํฐํฐ์ธ ๊ฒฝ์ฐ Transaction ์์์ ์ํฐํฐ๋ฅผ ๋ณ๊ฒฝํ๋ ๊ฒฝ์ฐ ๋ํฐ ์ฒดํน์ผ๋ก ์์ฑ๋๋ update ์ฟผ๋ฆฌ๋ ๊ธฐ๋ณธ์ ์ผ๋ก ๋ชจ๋ ํ๋๋ฅผ ์
๋ฐ์ดํธ ํจ JPA์์ ๋ณ๊ฒฝ๋ ํ๋๋ง update ํ์ง ์๊ณ ๋ชจ๋ ํ๋๋ฅผ ๋ณ๊ฒฝํ๋ ์ฟผ๋ฆฌ๋ฅผ ์์ฑํ๋ ์ด์ ๋, ๋ชจ๋ ํ๋๋ฅผ Update ์ฟผ๋ฆฌ๋ก ๋ง๋ค๋ฉด ..