프로젝트/미해결

[Querydsl] transform 함수 작동 X

나는아이스크림 2023. 6. 7. 09:21
728x90

spring boot 3.x 로 업그레이드하고 hibernate 버전은 6.2.2 로 세팅 후 querydsl 을 사용하여 코드를 작성하고 있었다.
간단한 select 문은 잘 작동되었으나 transform(groupBy().list()) 기능을 사용하려 했더니

java.lang.NoSuchMethodError: 'java.lang.Object org.hibernate.ScrollableResults.get(int)'
이런 오류가 나왔다....

 

아직 hibernate 홈페이지에도 qna를 올려놓았고 인프런에도 올려 놓았다.
답변을 기다려 보자.
https://discourse.hibernate.org/t/hibernate-6-2-2-querydsl-5-0-0-transform-function-is-not-working/7773

 

Hibernate 6.2.2 Querydsl 5.0.0 transform function is not working

Hi, I practice to study spring boot with making a small size project. I usually use spring boot version 2.x and recently upgrade 3.x and hibernate version is 6.2.2 . After upgrade I coding with querydsl without any problem. But I’m trying to transform(gr

discourse.hibernate.org

https://www.inflearn.com/questions/896778/spring-boot-3-x-%EC%97%85%EA%B7%B8%EB%A0%88%EC%9D%B4%EB%93%9C-%ED%9B%84-querydsl-transform-%ED%95%A8%EC%88%98-%EC%9E%91%EB%8F%99%EC%9D%B4-%EC%95%88%EB%90%A9%EB%8B%88%EB%8B%A4

 

spring boot 3.x 업그레이드 후 querydsl transform 함수 작동이 안됩니다. - 인프런 | 질문 & 답변

안녕하세요. spring boot 3.1.0 으로 업그레이드하여 hibernate 6.2.2 버전을 사용하고 있습니다.Querydsl 로 개발 도중 간단한 select 문은 정상적으로 작동이 되었는데,transform(groupBy().list()) 함수를 사용하니

www.inflearn.com

 

 

코드

@Override
public List<FoodDto> findFoodDtoByFoodSearch(FoodSearch foodSearch) {
    List<FoodDto> result = queryFactory
            .selectFrom(food)
            .join(food.foodCategories, foodCategory)
            .join(foodCategory.category, category).on(category.id.in(foodSearch.getCategoryIds()))
            .join(food.foodPictures, foodPicture).on(foodPicture.isThumbnail.eq(true))
            .where(
                    containsStoreNameOrAddress(foodSearch.getSearchText())
            )
            .transform(
                    groupBy(food.id).list(
                            new QFoodDto(
                                    food.id, food.storeName, food.score, food.title, food.visitDate,
                                    list(new QCategoryDto(category.name)),
                                    foodPicture.originalFileName, foodPicture.storedFileName
                            )
                    )
            );

    return result;
}
728x90
728x90