Spring boot @Formula사용해서 Count Query 하기
@Formula Spring boot Hibernate @Formula 사용하여 Count 하기 프로젝트를 진행할 떄 게시판을 만든다는 가정을 한다. 게시글 댓글이 1:N의 관계이다. 만약 게시글을 불러오면서 댓글의 총 갯수를 알고 싶을때 @Formula 어노테이션을 유용하게 사용 할 수 있을 듯하다. Entity 수정 @Entity public class Board { private Long id; private String title; private String contents; @Formual("(select count(1) from board_comment bc where bc.board_id = id)") private int totalCommentCount; } @Formula 어노테이션을 붙..
Dev/Spring
2020. 7. 12. 15:53
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- booleanExpression
- ubuntu
- Java
- 유사결과
- 웹서비스
- like절
- 스프링부트
- Spring
- FastAPI
- ControllerAdvice
- 자바
- 스프링
- Python
- springsecurity
- spring web
- 개발
- howtoinstallnginx
- 스프링시큐리티
- java11
- JPA
- paawordencoder
- ResourceHttpReqeustHandler
- mapstruct
- API
- 스프링부트 시작하기
- boot
- Security
- springboot
- @formula
- QueryDSL
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함