herdin0600
@herdin0600
Reviews Written
2
Average Rating
5.0
Posts
Q&A
querydsl ๋น๋ ์๋ฌ ์ง๋ฌธ๋๋ฆฝ๋๋ค.
์ธํ ๋ฆฌ ์ ์ด ์ฐ์๋ฉด File | Settings | Build, Execution, Deployment | Build Tools | Gradle ์ค์ ์์ Build and run using: IntelliJ IDEA ๋ก ๋ณ๊ฒฝํด๋ณด์ จ๋์? ์์ ๋ชจ๋ฅด๋๋ฐ gradle ๋ก ๋น๋๋ฅผ ํ ๊ฒฝ์ฐ์ ์ ๋ฐ ๋ฌธ์ ๊ฐ ์๊ธฐ๋๊ตฐ์.
- 0
- 3
- 5.9K
Q&A
querydsl ์ค์ ๊ด๋ จ ์ง๋ฌธ๋๋ฆฝ๋๋ค.
์ธํ ๋ฆฌ ์ ์ด ์ฐ์๋ฉด File | Settings | Build, Execution, Deployment | Build Tools | Gradle ์ค์ ์์ Build and run using: IntelliJ IDEA ๋ก ๋ณ๊ฒฝํด๋ณด์ จ๋์?
- 1
- 10
- 15K
Q&A
@NonNull
์ ์น์ ํ ๋ต๋ณ ๊ฐ์ฌ๋๋ฆฝ๋๋ค :)
- 0
- 5
- 480
Q&A
@NonNull
save ๋ ๊ฐ์ ๋ด์ฉ์ ์์๊ตฐ์. ใ ใ ์ฃ์กํฉ๋๋ค. ์ง๋ฌธ๋ ๊ตฌ์ฒด์ ์ด์ง ๋ชปํด์ ์ฃ์กํฉ๋๋ค. entity ์ฝ๋ @Entity public class Post { @Id @GeneratedValue Long id; String text; @OneToMany(mappedBy = "commentedPost", cascade = CascadeType.PERSIST, fetch = FetchType.EAGER) Set comments; //constructor/getter/setter/... } repository ์ฝ๋ public interface PostRepository extends JpaRepository { Optional findByText(@NonNull String text); Optional findByTextContaining(@NonNull String text); Post save(Post post); } ํ ์คํธ ์ฝ๋ @Test public void findByText() { Optional byText = postRepository.findByText(null); //์ฌ๊ธฐ์ post0_.text is null ์กฐ๊ฑด์ผ๋ก jpa ๊ฐ ์ฟผ๋ฆฌ๋ฅผ ์คํํฉ๋๋ค. logger.debug("by text -> {}", byText); assertTrue(byText.isEmpty()); } @Test public void findByTextContaining() { Optional byText = postRepository.findByTextContaining(null); //์ฌ๊ธฐ์ Assert.notNull ์์ธ๊ฐ ๋ฐ์ํฉ๋๋ค. logger.debug("by text -> {}", byText); assertTrue(byText.isEmpty()); }
- 0
- 5
- 480




