본문 바로가기

Study/JPA

[오류] org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.query.SyntaxException

org.springframework.dao.InvalidDataAccessApiUsageException: org.hibernate.query.SyntaxException: At 1:26 and token 'fetch', mismatched input 'fetch', expecting one of the following tokens: <EOF>, ',', CROSS, FULL, GROUP, INNER, JOIN, LEFT, ORDER, OUTER, RIGHT, WHERE [select o from Order ojoin fetch o.member mjoin fetch o.delivery d]

 

 

select o from Order o 뒤에 띄어쓰기 안해서 생긴 오류 .......

띄어쓰기를 잘 하자 .....;;;;;;;

그래도 친절하게 어디에서 오류났는지 알려줘서 좋네 ..

 

    // 수정 전
    public List<Order> findAllWithMemberDelivery() {
        return em.createQuery(
                "select o from Order o" +
                        "join fetch o.member m" +
                        "join fetch o.delivery d", Order.class)
                .getResultList();
    }

 

    // 수정 후
    public List<Order> findAllWithMemberDelivery() {
        return em.createQuery(
                "select o from Order o " +
                        "join fetch o.member m " +
                        "join fetch o.delivery d", Order.class)
                .getResultList();
    }

 

 

'Study > JPA' 카테고리의 다른 글

JPA 시작  (0) 2023.12.04
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException  (0) 2023.12.04