백견불여일타 스프링 부트 쇼핑몰 프로젝트 with JPA - 수정 부분

DOUIK·2022년 6월 8일
0

https://github.com/ultraq/thymeleaf-layout-dialect

ThymeleafEx07.html 부분

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
        layout:decorate="~{layouts/layout1}">

    <section  layout:fragment="content">
        본문 영역입니다.
    </section>
</html>

책에선 div로 되어있는데 section 태그 사용해야 적용됨

CartItemRepository

(Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: For queries with named parameters you need to use provide names for method parameters. Use @Param for query method parameters, or when on Java 8+ use the javac flag -parameters.; nested exception is java.lang.IllegalStateException)

@Param 쓰라는 오류 나는데

@Query("select new com.shop.shop.dto.CartDetailDto(ci.id, i.itemNm, i.price, ci.count, im.imgUrl) " +
            "from CartItem ci, ItemImg im " +
            "join ci.item i " +
            "where ci.cart.id = :cartId " +
            "and im.item.id = ci.item.id " +
            "and im.repImgYn = 'Y' " +
            "order by ci.regTime desc"
            )
    List<CartDetailDto> findCartDetailDtoList(@Param("cartId")Long cartId);

findCartDetailDtoList 함수에 Long cartId 앞에 @Param("cartId") 붙여주면 해결됨

0개의 댓글