제로초님! 강의와는 조금 무관한 질문이지만, 보통 실무에서 디자이너 퍼블리셔 분들이랑 협업을 해야 할텐데, 그 분들이 프레임워크를 모르실 경우 그냥 HTML, CSS, 제이쿼리로 작업을 해서 주실텐데 그럼 프론트 개발자는 그걸 분해해서 프레임워크 적용하나요? 보통 디자이너나 퍼블리셔 분들과 어떤 방식으로 협업이 진행되는지 궁금해요!
안녕하세요. 게시글을 등록하는 기능을 구현중인데, LazyInitializationException 에러를 해결 못하고 있습니다. 테이블 관계(Account - Post) 는 양방향 관계로 설정하였고, 다음과 같이 설정했습니다. Account 테이블 @Entity @Getter @Setter public class Account implements UserDetails { @Id @GeneratedValue private Integer accountNo ; // 다른 컬럼들 생략... @OneToMany ( mappedBy = "account" ) private List < Post > post = new ArrayList <>(); Post 테이블 @Entity @Getter @Setter public class Post { @Id @GeneratedValue ( strategy = GenerationType . IDENTITY ) private Integer postNo ; @ManyToOne @JoinColumn ( name = "accountNo" ) private Account account ; //다른 컬름들 생략... public void setAccount ( Account account ) { if ( this . account != null ){ this . account . getPost (). remove ( this ); } this . account = account ; this . account . getPost (). add ( this ); } 문제가 발생한 로직 함수 부분 @PostMapping ( "" ) public ResponseEntity enrollPost ( @RequestParam ( "file" ) MultipartFile multipartFile , @RequestParam ( "content" ) String content , @RequestParam ( "score" ) float score , @AuthenticationPrincipal Account account ) throws Exception { Path fileNameAndPath = Paths . get ( "./images/" , multipartFile . getOriginalFilename ()); try { Files . write ( fileNameAndPath , multipartFile . getBytes ()); } catch ( IOException e ){ throw new InvalidImageException ( "이미지 업로드에 실패했습니다." ); } Post post = new Post (); post . setScore ( score ); post . setContent ( content ); post . setPostPic ( fileNameAndPath . toString ()); post . setAccount ( account ); << 문제가 발생한 부분!! ############# Post save = postRepository . save ( post ); 위와 같습니다. 문제가 발생한 부분은 아래 함수를 처리하다가 오류가 생겼습니다. 위의 post.setAccount(account) 부분에서 public void setAccount ( Account account ) { if ( this . account != null ){ this . account . getPost (). remove ( this ); } this . account = account ; this . account . getPost (). add ( this ); << 문제가 발생한 지점!! ############## } account.getPost()를 가져오는 부분에서 Lazy초기화에러가 발생했습니다. 해당 문제는 Account의 post @OneToMany 컬럼에 fetch = FetchType.EAGER 설정을 주면 쉽게 해결이 되는데, Post의 FetchType을 Eager로 주게 될 경우, 유저를 조회할 때마다 항상 Post를 조회하는게 성능상 문제가 될것같아서 위와 같은 방식은 사용하고 싶지 않습니다. @PostMapping 함수 로직을 실행하기전에 @AuthenticationPrincipal Account account 인증권한 확인하는부분에서 Accont의 데이터를 한번 조회해오는데, 로그는 다음과 같습니다. /* select generatedAlias0 from Account as generatedAlias0 where generatedAlias0.email=:param0 */ select account0_.accountNo as accountN1_0_, account0_.accountId as accountI2_0_, account0_.accountName as accountN3_0_, account0_.accountPwd as accountP4_0_, account0_.authority as authorit5_0_, account0_.bio as bio6_0_, account0_.email as email7_0_, account0_.instagram as instagra8_0_, account0_.profilePic as profileP9_0_, account0_.regDate as regDate10_0_, account0_.twitter as twitter11_0_, account0_.updDate as updDate12_0_, account0_.useStateCode as useStat13_0_ from Account account0_ where account0_.email=? Account 테이블에서 Post를 참조하고 있는 리스트를 가지고 오지 않아서 에러가 발생하는것 같은데, 어떻게 하면 Account가 참조하고 있는 Post정보를 가지고올 수 있을까요? 에러가 발생한 로그는 아래와 같습니다. // 2020-01-20 22:04:40.867 ERROR 6330 --- [nio-8098-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.toffeestory.backend.account.Account.post, could not initialize proxy - no Session] with root cause // // org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.toffeestory.backend.account.Account.post, could not initialize proxy - no Session // at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:602) ~[hibernate-core-5.3.11.Final.jar:5.3.11.Final] // at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:217) ~[hibernate-core-5.3.11.Final.jar:5.3.11.Final] // at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:581) ~[hibernate-core-5.3.11.Final.jar:5.3.11.Final] // at org.hibernate.collection.internal.AbstractPersistentCollection.write(AbstractPersistentCollection.java:408) ~[hibernate-core-5.3.11.Final.jar:5.3.11.Final] // at org.hibernate.collection.internal.PersistentBag.add(PersistentBag.java:386) ~[hibernate-core-5.3.11.Final.jar:5.3.11.Final] // at com.toffeestory.backend.post.Post.setAccount(Post.java:55) ~[main/:na] // at com.toffeestory.backend.post.PostController.enrollPost(PostController.java:55) ~[main/:na]
파이참을 사용하고있습니다. C에 ImgTest라는 폴더를 만들고 savePath = "C:\ImgTest \t est1.jpg" 이렇게 해서 urlretrieve를 사용하면 OSError: [Errno 22] Invalid argument: 'C:\\ImgTest\test1.jpg' 이런 에러가 나옵니다. 그런데 E드라이브를 path로 해주면 어느 폴더든 간에 아무 문제없이 잘 됩니다. 그리고 savePath = "C:test1.jpg" 이렇게 하면 Section2프로젝트 파일안에 저장이 되는데 뭐가 문제인건가요?
파일 구조를 보면 제가 이해하기로는 PhoneForm.js : 이름과 전화번호를 입력받고 입력상태를 App.js 로 넘기기 PhoneInfoList.js : App.js 에 데이터를 PhoneInfoList.js 에서 받고 데이터를 map으로 돌려서 list 로 만들어준 후 PhoneInfo.js : PhoneInfoList 에서 받은 list 를 style 에 맞게 보여준다. 이렇게 이해를 했는데요. PhoneInfoList 와 PhoneInfo 를 구분한 이유가 궁금합니다. App.js 의 데이터를 PhoneInfo 에서 받아서 map 을 사용해서 바로 style 에 맞게 화면이 보여주게 할 수도 있을텐데 List 로 만들어주고 화면에 보여주는 파일을 구분해주는 이유가 무엇인가요?
선생님 안녕하세요. 질문이 있습니다 100 mnist digit 실행하기 했는데 --------------------------------------------------------------------------- NameError Traceback (most recent call last) <ipython-input-1-53a8acc96182> in <module> 28 ax . grid ( which = 'major' , alpha = 0.5 ) 29 ---> 30 ax . imshow ( x_test_original [ selected_image ] , cmap = plt . cm . binary ) 31 32 plt . show ( ) NameError : name 'x_test_original' is not defined 이 오류가 계속 뜨는데 왜 그런지 알 수 있을까요??
todoItems의 원본 데이터 변경 측면에서 slice가 아닌 splice 사용을 강조하셨는데, 리액트와 비교해서 궁금증이 생겨서 질문드립니다. 리액트에서는 state변경시 이전 state의 불변성을 유지하기 위해 새로운 객체를 생성하여 넣는 방식을 사용하는데 뷰에서는 이와는 반대되는 개념인가요? 저는 this.todoItems = [선택된 아이템이 제거된 새로운 배열] 이렇게 구현할거라 생각했었는데 예상과 달라서 질문드립니다. 두 가지 방법 모두 정상적으로 동작하는 것처럼 보입니다만 후자의 경우 제가 모르는 잠재적 문제가 있는것인가요?
안녕하세요 ZeroCho 님, 6강 미들웨어 꿀팁들 강좌에서 에러 처리 관련 질문 드립니다. res.locals.error = req.app.get('env') === 'development' ? err: {}; 1) 이 구문에서 req.app.get('env') 가 반환하는 반환값이 어떻게 되는지 알수 있을까요? Express 사이트에서는 app.configure() 함수가 제거되고 대신 app.get('env') 나 process.env 로 대체 되었 다고 나와 있더라구요. 2) req.app.get('env') 에서 'env' 와 app.use(logger('dev')) 에서 'dev' 가 정확히 무엇인지 잘 모르겠 습니다. 혹시 이게 predefined event (미리 정의된 이벤트) 인가요? 감사 합니다.
sequelize, sequelize-cli 설치 이상없이 완료되었는데, init시 하기와 같이 또는 보안에러를 어떻게 조치하면 될까요? ----------------------------------------------- sequelize : 이 시스템에서 스크립트를 실행할 수 없으므로 C:\Users\Admin\AppData\Roaming\npm\sequelize.ps1 파일을 로드할 수 없습니다. 자세한 내용은 about_Execution_Policies(https://go.microsoft.com/fwlink/?LinkID=135170)를 참조하십시오. 위치 줄:1 문자:1 + sequelize init; + ~~~~~~~~~ + CategoryInfo : 보안 오류: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
예를 들어 두 가지의 비동기 디스패치 A, B가 있다고 했을 때, A_SUCCESS가 실행되면 바로 B_REQUEST를 실행하고 싶습니다. 저 같은 경우는 우선, redux-saga에 A_SUCCESS를 watch하는 함수를 만들어서 A_SUCCESS가 디스패치 될 경우 바로 B_REQUEST를 put되게 만들었는데요. 이게 정석적인 방법인 건지, 더 간단한 방법이 있다거나 이때 사용할 수 있는 saga 함수가 있는 지 궁금합니다.