묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결스프링과 JPA 기반 웹 애플리케이션 개발
@NamedEntityGraph 와 Fetch
안녕하세요, 강의 잘 보고 있습니다. @NamedEntityGraph로 N+1 select를 해결하는것은 잘 되는데요, 문득 궁금증이 생겨 @NamedEntityGraph를 제거하고 그냥 해당 필드에 EAGER를 붙여보았습니다. Notification entity를 조회할 때 참조하고있는 Tag entity를 같이 가져오는 것을 구현연습 하고 있었습니다. Notification.java @Entity @Getter @Setter @EqualsAndHashCode(of = "id") @NoArgsConstructor public class Notification { @Id @GeneratedValue private Long id; @Enumerated(EnumType.STRING) private NotificationType notificationType; private String title; private String link; private boolean ringBellChecked = false; private boolean linkVisited = false; @ManyToOne private Account account; @ManyToMany(fetch = FetchType.EAGER) private List<Tag> commonTag = new LinkedList<>(); private LocalDateTime createdDateTime; } NotificationRepository.java public interface NotificationRepository extends JpaRepository<Notification, Long> { List<Notification> findByAccount(Account sessionAccount); } 그리고 이를 활용하여 NotificationService.java @Transactional @RequiredArgsConstructor @Service public class NotificationService { private final NotificationRepository notificationRepository; public List<Notification> ringBellCheck(Account sessionAccount) { List<Notification> allNotification = notificationRepository.findByAccount(sessionAccount); allNotification.forEach(notification -> { notification.setRingBellChecked(true); }); return allNotification; } } 위와같은 작업을 처리합니다. 근데 현재 Notification이 3개가 존재할 때, 2020-07-28 10:14:57.791 DEBUG 15072 --- [nio-8080-exec-9] org.hibernate.SQL : select notificati0_.id as id1_2_, notificati0_.account_id as account_8_2_, notificati0_.created_date_time as created_2_2_, notificati0_.link as link3_2_, notificati0_.link_visited as link_vis4_2_, notificati0_.notification_type as notifica5_2_, notificati0_.ring_bell_checked as ring_bel6_2_, notificati0_.title as title7_2_ from notification notificati0_ where notificati0_.account_id=? 2020-07-28 10:14:57.792 TRACE 15072 --- [nio-8080-exec-9] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1] 2020-07-28 10:14:57.840 DEBUG 15072 --- [nio-8080-exec-9] org.hibernate.SQL : select account0_.id as id1_0_0_, account0_.bio as bio2_0_0_, account0_.count_of_sending_email_verification_email as count_of3_0_0_, account0_.email_first_verified as email_fi4_0_0_, account0_.email_verification_token as email_ve5_0_0_, account0_.email_verified as email_ve6_0_0_, account0_.email_waiting_to_be_verified as email_wa7_0_0_, account0_.first_count_of_sending_email_verification_email_set_date_time as first_co8_0_0_, account0_.location as location9_0_0_, account0_.nickname as nicknam10_0_0_, account0_.nickname_before_update as nicknam11_0_0_, account0_.notification_comment_on_my_comment_by_email as notific12_0_0_, account0_.notification_comment_on_my_comment_by_web as notific13_0_0_, account0_.notification_comment_on_my_post_by_email as notific14_0_0_, account0_.notification_comment_on_my_post_by_web as notific15_0_0_, account0_.notification_like_on_my_comment_by_email as notific16_0_0_, account0_.notification_like_on_my_comment_by_web as notific17_0_0_, account0_.notification_like_on_my_post_by_email as notific18_0_0_, account0_.notification_like_on_my_post_by_web as notific19_0_0_, account0_.notification_my_interest_tag_added_to_existing_post_by_email as notific20_0_0_, account0_.notification_my_interest_tag_added_to_existing_post_by_web as notific21_0_0_, account0_.notification_new_post_with_my_interest_tag_by_email as notific22_0_0_, account0_.notification_new_post_with_my_interest_tag_by_web as notific23_0_0_, account0_.occupation as occupat24_0_0_, account0_.password as passwor25_0_0_, account0_.profile_image as profile26_0_0_, account0_.show_password_update_page_token as show_pa27_0_0_, account0_.sign_up_date_time as sign_up28_0_0_, account0_.user_id as user_id29_0_0_, account0_.verified_email as verifie30_0_0_ from account account0_ where account0_.id=? 2020-07-28 10:14:57.840 TRACE 15072 --- [nio-8080-exec-9] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1] 2020-07-28 10:14:57.888 DEBUG 15072 --- [nio-8080-exec-9] org.hibernate.SQL : select commontag0_.notification_id as notifica1_3_0_, commontag0_.common_tag_id as common_t2_3_0_, tag1_.id as id1_8_1_, tag1_.title as title2_8_1_ from notification_common_tag commontag0_ inner join tag tag1_ on commontag0_.common_tag_id=tag1_.id where commontag0_.notification_id=? 2020-07-28 10:14:57.889 TRACE 15072 --- [nio-8080-exec-9] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [15] 2020-07-28 10:14:57.937 DEBUG 15072 --- [nio-8080-exec-9] org.hibernate.SQL : select commontag0_.notification_id as notifica1_3_0_, commontag0_.common_tag_id as common_t2_3_0_, tag1_.id as id1_8_1_, tag1_.title as title2_8_1_ from notification_common_tag commontag0_ inner join tag tag1_ on commontag0_.common_tag_id=tag1_.id where commontag0_.notification_id=? 2020-07-28 10:14:57.937 TRACE 15072 --- [nio-8080-exec-9] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [13] 2020-07-28 10:14:57.984 DEBUG 15072 --- [nio-8080-exec-9] org.hibernate.SQL : select commontag0_.notification_id as notifica1_3_0_, commontag0_.common_tag_id as common_t2_3_0_, tag1_.id as id1_8_1_, tag1_.title as title2_8_1_ from notification_common_tag commontag0_ inner join tag tag1_ on commontag0_.common_tag_id=tag1_.id where commontag0_.notification_id=? 2020-07-28 10:14:57.984 TRACE 15072 --- [nio-8080-exec-9] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [11] 2020-07-28 10:14:58.137 DEBUG 15072 --- [nio-8080-exec-9] org.hibernate.SQL : select count(notificati0_.id) as col_0_0_ from notification notificati0_ where notificati0_.account_id=? and notificati0_.ring_bell_checked=? 2020-07-28 10:14:58.137 TRACE 15072 --- [nio-8080-exec-9] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [BIGINT] - [1] 2020-07-28 10:14:58.137 TRACE 15072 --- [nio-8080-exec-9] o.h.type.descriptor.sql.BasicBinder : binding parameter [2] as [BOOLEAN] - [false] 이처럼 필드에 EAGER를 붙인것은 N+1 select 문제가 해결되진 않네요. 하나의 Notification만 Id로 조회했을 때는 Tag도 같이 가져오는걸 확인했습니다. 하지만 List<Notification>에서는 적용이 안되네요. 필드에 EAGER를 붙이는 것은 하나만 조회할 때 유효한 건가요? 그리고 NotificationInterceptor.java에서 SecurityContextHolder에서 세션객체 꺼내서 해당 세션객체로 Notification를 조회할 때는 왜 Account를 조회하는 쿼리는 안날아가나요? detached상태인데.. NotificationService에서 Account로 Notification을 조회했을 때는 새로 Account를 다시 조회하는 쿼리가 날아가는데..
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
의존관계 주입관련해서 질문 있습니다.
안녕하세요~ 강의잘보고 있습니다!!! 강의를 듣다가 의존관계(DI) 주입관련해서 의문이 생겼습니다. 저는 기존에 @Autowired 어노테이션을 사용하여 의존관계를 설정하였는데 김영한님 뿐만 아니라 다른 블로그를 찾아봐도 생성자 주입을 통해 DI 설정을 하고 있는데 Autowired를 사용하지않고 생성자 주입했을 때의 장점을 알려주셨으면 좋겠습니다 ㅎㅎ
-
미해결누구든지 하는 리액트: 초심자를 위한 react 핵심 강좌
create-react-app 오류 (Cannot find module './encoding/utf8')
안녕하세요, 윈도우 환경에서 yarn 을 사용하여 create-react-app을 설치했습니다. create-react-app <프로젝트 이름>을 사용하여 프로젝트를 생성하려고 하는데, 아래와 같은 오류가 나면서 안되네요. 어떻게 해결해야 하나요?? Error: Cannot find module './encoding/utf8' Require stack: - C:\Users\charm\Documents\bus-control\node_modules\chardet\index.js - C:\Users\charm\Documents\bus-control\node_modules\external-editor\main\index.js - C:\Users\charm\Documents\bus-control\node_modules\inquirer\lib\prompts\editor.js - C:\Users\charm\Documents\bus-control\node_modules\inquirer\lib\inquirer.js - C:\Users\charm\Documents\bus-control\node_modules\react-dev-utils\browsersHelper.js - C:\Users\charm\Documents\bus-control\node_modules\react-scripts\scripts\init.js - C:\Users\charm\Documents\bus-control\[eval] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1065:15) at Function.Module._load (internal/modules/cjs/loader.js:911:27) at Module.require (internal/modules/cjs/loader.js:1125:19) at require (internal/modules/cjs/helpers.js:75:18) at Object.<anonymous> (C:\Users\charm\Documents\bus-control\node_modules\chardet\index.js:4:13) at Module._compile (internal/modules/cjs/loader.js:1236:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1257:10) at Module.load (internal/modules/cjs/loader.js:1085:32) at Function.Module._load (internal/modules/cjs/loader.js:950:14) at Module.require (internal/modules/cjs/loader.js:1125:19) { code: 'MODULE_NOT_FOUND', requireStack: [ 'C:\\Users\\charm\\Documents\\bus-control\\node_modules\\chardet\\index.js', 'C:\\Users\\charm\\Documents\\bus-control\\node_modules\\external-editor\\main\\index.js', 'C:\\Users\\charm\\Documents\\bus-control\\node_modules\\inquirer\\lib\\prompts\\editor.js', 'C:\\Users\\charm\\Documents\\bus-control\\node_modules\\inquirer\\lib\\inquirer.js', 'C:\\Users\\charm\\Documents\\bus-control\\node_modules\\react-dev-utils\\browsersHelper.js', 'C:\\Users\\charm\\Documents\\bus-control\\node_modules\\react-scripts\\scripts\\init.js', 'C:\\Users\\charm\\Documents\\bus-control\\[eval]' ]
-
미해결Python 부트캠프
코드 다운로드 파일 주소 확인 요청
인쇄용 pdf 말고 코드 복사할 수 있는 다운로드 페이지 열리지가 않습니다.(비틀리 페이지) 시간이 부족하다보니 코드들을 복사, 붙여넣기로 해야 할 것 같은데 페이지가 열리지 않아 결과들을 많이 못보고 있습니다. 확인 부탁 드립니다.
-
미해결대세는 쿠버네티스 (초급~중급편)
ingress에서 인증서 생성에 관해
openssl로 인증서를 생성하고 만들어진 tls.key파일로 secret을 생성하는데 openssel을 그냥 아무데서나 내가 이용할 도메인이름으로 생성하면 되는건가요? 생성된 인증서랑 어떻게 nginx랑 맵핑(?)되어 인식되는지 어느위치에서 해야 하는지 헷갈립니다. ㅠㅠ
-
해결됨페이스북 클론 - full stack 웹 개발
activate 토글
좋아요 버튼을 누를때마다 클래스에 active가 들어갔다가 나오는데, 한번 클릭을 하고 active가 들어가있는 상태에서 새로고침을 하면 다시 active가 없는 상태가 됩니다. 새로고침을 하더라도 좋아요가 눌러져있다면 active가 남아있게 하는 방법이 있을까요?
-
미해결파이썬 사용자를 위한 웹개발 입문 A to Z Django + Bootstrap
detail의 레이아웃과 list의 레이아웃이 다릅니다
오른쪽에 있어야할 widget과 category가 detail페이지에서만 하단에 위치합니다아무리봐도 뭐가문젠지 모르겠습니다... 어차피 템플릿확장으로 base.html을 post_detail과 post_list가 공유할텐데왜 post_list페이지는 정상적으로 배치되어있고detail만 이럴까요? startbootstrap의 detail부분 페이지 소스와 저의 base.html소스의 일부를 첨부합니다
-
해결됨[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진
콘솔창에 표시가 안 뜹니다.
맨마지막 실습 중에 Get<GameObject>((int)GameObjects.ItemIcon).AddUIEvent((PointerEventData) => { Debug.Log($"아이템 클릭! {_name}"); }); 를 추가해서 아이템을 누르면 콘솔창에 표시되도록 해보는 실습을 하고 있는데 콘솔창에 표시가 안뜹니다. 선생님께서 작성하시는대로 따라서 작성했는데도 콘솔창에 문구가 뜨지 않습니다.. 혹시 왜 이런 오류가 생기는지 짐작되는부분이 있을까요..?
-
미해결스프링 웹 MVC
블로그 정리 관련하여 문의 드립니다.
안녕하세요 백기선선생님의 강의를 스프링 프레임워크 핵심 기술을 듣고 현재 웹 MVC 강좌를 듣는 학생입니다. 스프링 프레임워크 핵심 기술 질의 응답에서 블로그 정리를 하셔도 괜찮다는 글을 보고 현재 블로그에 웹 MVC 강좌를 들은 내용을 정리하여 올리고 있는데 직접 문의를 드리고 올리는 것이 맞다고 생각되어 문의를 드립니다. 항상 좋은 강의를 올려 주셔서 감사합니다.
-
미해결남박사의 파이썬 기초부터 실전 100% 활용
질문드립니다
1. requests.get에 들어있는 stream=True의미는 무엇인가요? 그리고 .raw와 .content는 어떤 역할을 해주나요? 2.cv2.destroyAllWindows()가 키가 눌렸을때 모든 윈도우 창을 꺼준다고 하셨는데 위 코드가 없어도 바뀌는게 보이지 않습니다.정확히 어떤 역할을 하는지 알고싶습니다.
-
미해결데브옵스(DevOps)를 위한 쿠버네티스 마스터
ingress nginx 관련 질문입니다.
일반적으로 ingress --- svc(NodePort) --- pod로 연결 되는 구조로 되어 있는 걸로 이해하는데 지금 실습은 ingress를 만들고 다시 node의 IP로 접속을 하는데 실제.....그냥 인그레스 없이 노드 포트로 연결 된 것과 차이를 모르겠습니다. 원래 SVC앞단에 인그레스가 와야 하는것이 아닌지요??
-
미해결데브옵스(DevOps)를 위한 쿠버네티스 마스터
nginx ingress관련 링크가 없습니다.
강의와 관련있는 질문을 남겨주세요.• 강의와 관련이 없는 질문은 지식공유자가 답변하지 않을 수 있습니다. (사적 상담, 컨설팅, 과제 풀이 등)• 질문을 남기기 전, 비슷한 내용을 질문한 수강생이 있는지 먼저 검색을 해주세요. (중복 질문을 자제해주세요.)• 서비스 운영 관련 질문은 인프런 우측 하단 ‘문의하기’를 이용해주세요. (영상 재생 문제, 사이트 버그, 강의 환불 등) 질문 전달에도 요령이 필요합니다.• 지식공유자가 질문을 좀 더 쉽게 확인할 수 있게 도와주세요.• 강의실 페이지(/lecture) 에서 '질문하기'를 이용해주시면 질문과 연관된 수업 영상 제목이 함께 등록됩니다.• 강의 대시보드에서 질문을 남길 경우, 관련 섹션 및 수업 제목을 기재해주세요. • 수업 특정 구간에 대한 질문은 꼭 영상 타임코드를 남겨주세요! 구체적인 질문일수록 명확한 답을 받을 수 있어요.• 질문 제목은 핵심 키워드를 포함해 간결하게 적어주세요.• 질문 내용은 자세하게 적어주시되, 지식공유자가 답변할 수 있도록 구체적으로 남겨주세요.• 정확한 질문 내용과 함께 코드를 적어주시거나, 캡쳐 이미지를 첨부하면 더욱 좋습니다. 기본적인 예의를 지켜주세요.• 정중한 의견 및 문의 제시, 감사 인사 등의 커뮤니케이션은 더 나은 강의를 위한 기틀이 됩니다. • 질문이 있을 때에는 강의를 만든 지식공유자에 대한 기본적인 예의를 꼭 지켜주세요. • 반말, 욕설, 과격한 표현 등 지식공유자를 불쾌하게 할 수 있는 내용은 스팸 처리 등 제재를 가할 수 있습니다.
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진
Data Manager까지 수업을 들었는데요
코드 실행을 하면 UnassignedReferenceException: The variable _player of CameraController has not been assigned. You probably need to assign the _player variable of the CameraController script in the inspector. CameraController.LateUpdate () (at Assets/Scripts/Controllers/CameraController.cs:26) 이런 로그가 계속해서 뜨는데 왜 생기는거고 어떻게 없애야 할까요?
-
해결됨[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진
캐릭터의 이동과 RigidBody 관련 설정에 대해서
본 수업의 다른 질문에서 '불멸의너구리좌'님께서 말씀해주신 질문과 비슷한 문제인데요, RigidBody 컴포넌트에 의해 캐릭터가 이동 및 회전 시 물리적인 힘이 가해지고, 이 힘이 계속 남아있어 한번 넘어지게 되면 다시 이동을 시켜도 계속 넘어진 상태로 있게 됩니다. 이 점을 해결하기 위한 좋은 방법은 y축을 Freeze하는 방법이 제일 좋은 방법인가요? 또 하나 파생 질문을 드리자면 예를 들어 오버워치는 캐릭터가 평소엔 벽에 부딪혀도 쓰러지거나 하지 않는데, 캐릭터가 사망하게 되면 쓰러져서 데굴데굴 굴러다니게 됩니다. 이런 상황에서는 평소엔 y축이 Freeze 상태였다가 생명력이 0이 되면 Freeze가 풀리게 되는 식으로 구현이 되는 건가요?3D 게임에서 캐릭터 오브젝트들의 RigidBody를 어떻게 설정해주는게 보편적인지 궁금해요.
-
미해결스프링 부트 개념과 활용
테스트 질문입니다!
테스트 강의를 듣던 중에 궁금합니다. 아직 초보라서 그런지, 왜 테스트를 해야 하는지 이해가 잘 안갑니다. 테스트로 돌리는 코드와 일반 코드는 무슨 차이가 있는건가요?? 강의에서도 그냥 일반적인 Runner에서 돌리는 것이랑 뭐가 다른지 잘 모르겠습니다ㅠㅠ
-
미해결HTML+CSS+JS 포트폴리오 실전 퍼블리싱(시즌1)
안 배운것들이 잔뜩 나오는데
키프레임, 플렉스, 애니메이션, 오파시티 등등 이런거는 앞의 강의에서 없던 내용인데 그냥 실습 따라하면서 외우는 건가요? 이부분은 이론이 필요없나요?
-
해결됨HTML+CSS+JS 포트폴리오 실전 퍼블리싱(시즌1)
가상클래스 before after 가상클래스 활용한 실전 퍼블리싱 04
안녕하세요! 질문드립니다. 부모 태그에 overflow:hidden의 효과가 첫 번째, 부모 태그의 영역을 넘어가는 부분을 숨겨주는 것과 두 번째, 자식 태그가 float:left로 인해서 공중에 떴을 때 부모 태그의 높이값이 사라졌을 때 높이값을 자동으로 찾아준다 이렇게 대표적으로 두 가지로 알고 있으면 될까요? 또 overflow:hidden은 visibility:hidden처럼 영역을 차지하되 보이는 것만 숨겨준 효과라고 보면 될까요?
-
미해결Pandas 팬더스 데이터분석 기초 실습
filter like
df.filter(like='a', axis=1) 을 하면 a가 포함된 name과 age의 데이터만 나오잖아요 name데이터 안에서 필터를 하고싶은데 어떻게해야되나요?? 예를들어 filter='j' 이런식으로 한다하면 name안에 있는 데이터 중 j가 포함된 John, Jenny,Julia 의 데이터를 뽑고싶은데 어떻게 해야될까요?
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
yolov3 pytorch 관련 질문 custom dataset 중
강의에는 없는 듯 하나 pytorch yolov3 로 custom data를 학습하려는데 자꾸 에러가 납니다. File "E:\source\pysource\PyTorch-YOLOv3-master\PyTorch-YOLOv3-master\models.py", line 263, in forward yolo_outputs = to_cpu(torch.cat(yolo_outputs, 1)) RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function is registered for schema aten::_cat. This usually means that this function requires a non-empty list of Tensors. Available functions are [CPUTensorId, QuantizedCPUTensorId, VariableTensorId] print로 해본 결과 입력에 들어가는 이미지 값들은 값이 나오는데 왜 tensor argument가 empty로 전달되었는지를 모르겠습니다. File "E:/source/pysource/PyTorch-YOLOv3-master/PyTorch-YOLOv3-master/train.py", line 111, in <module> loss, outputs = model(imgs, targets)
-
미해결대세는 쿠버네티스 (초급~중급편)
CentOS8 도커 설치시 패키지 의존성 문제
블로그에 나와있는 설치 방법대로 yum update -y && yum install -y docker-ce-19.03.8 명령어로 docker 19.03.8 버전 설치시 뜨는 의존성 문제입니다.CentOS8환경이고, 18.09.0버전으로 설치하니까 의존성문제 없이 설치돼었습니다.