인프런 커뮤니티 질문&답변

박태규님의 프로필 이미지
박태규

작성한 질문수

실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화

간단한 주문 조회 V4: JPA에서 DTO로 바로 조회

6분 56초 질문드립니다.

작성

·

1.2K

0

내용중 패키지를 만들고 없애고 해봐도 에러가 계속 납니다.

계속 에러가 나오는데 이유를 모르겠습니다 ㅠ

2022-02-08 10:59:00.744 ERROR 77312 --- [nio-8080-exec-2] o.h.hql.internal.ast.ErrorTracker        :  Unable to locate appropriate constructor on class [jpabook.jpashop.repository.order.dto.OrderSimpleQueryDto]. Expected arguments are: long, java.lang.String, java.time.LocalDateTime, jpabook.jpashop.domain.OrderStatus, jpabook.jpashop.domain.Address

[cause=org.hibernate.PropertyNotFoundException: no appropriate constructor in class: jpabook.jpashop.repository.order.dto.OrderSimpleQueryDto]

2022-02-08 10:59:00.746 ERROR 77312 --- [nio-8080-exec-2] o.h.hql.internal.ast.ErrorTracker        :  Unable to locate appropriate constructor on class [jpabook.jpashop.repository.order.dto.OrderSimpleQueryDto]. Expected arguments are: long, java.lang.String, java.time.LocalDateTime, jpabook.jpashop.domain.OrderStatus, jpabook.jpashop.domain.Address

[cause=org.hibernate.PropertyNotFoundException: no appropriate constructor in class: jpabook.jpashop.repository.order.dto.OrderSimpleQueryDto]

 

org.hibernate.hql.internal.ast.DetailedSemanticException: Unable to locate appropriate constructor on class [jpabook.jpashop.repository.order.dto.OrderSimpleQueryDto]. Expected arguments are: long, java.lang.String, java.time.LocalDateTime, jpabook.jpashop.domain.OrderStatus, jpabook.jpashop.domain.Address

at org.hibernate.hql.internal.ast.tree.ConstructorNode.resolveConstructor(ConstructorNode.java:182) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.ast.tree.ConstructorNode.prepare(ConstructorNode.java:144) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.ast.HqlSqlWalker.processConstructor(HqlSqlWalker.java:1258) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExpr(HqlSqlBaseWalker.java:2390) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectExprList(HqlSqlBaseWalker.java:2256) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectClause(HqlSqlBaseWalker.java:1518) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:597) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:325) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:273) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:276) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:192) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:144) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:113) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:73) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:162) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:604) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:716) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:816) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:113) ~[hibernate-core-5.4.25.Final.jar:5.4.25.Final]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]

at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:362) ~[spring-orm-5.3.2.jar:5.3.2]

at com.sun.proxy.$Proxy104.createQuery(Unknown Source) ~[na:na]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]

at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]

at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]

at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:311) ~[spring-orm-5.3.2.jar:5.3.2]

at com.sun.proxy.$Proxy104.createQuery(Unknown Source) ~[na:na]

at jpabook.jpashop.repository.order.simplequery.OrderSimpleQueryRepository.findOrderDtos(OrderSimpleQueryRepository.java:16) ~[classes/:na]

at jpabook.jpashop.repository.order.simplequery.OrderSimpleQueryRepository$$FastClassBySpringCGLIB$$1df97ea7.invoke(<generated>) ~[classes/:na]

 

 

소스 트리, 내용 첨부하겠습니다 ㅠㅠ

 

 

 

답변 2

0

박태규님의 프로필 이미지
박태규
질문자

헐,,,, 이걸 못봤네요.. 감사합니다 ㅠㅠ

0

안녕하세요. 박태규님, 공식 서포터즈 David입니다.

 

생성자의 접근제어자가 private으로 지정되어 있으시네요.

아래와 같이 public으로 변경해주세요:)

감사합니다.

박태규님의 프로필 이미지
박태규

작성한 질문수

질문하기