소개
게시글
질문&답변
조회질문
바쁘신와중에도 답변 정말 감사드립니다. 말씀하신것으로 코드를 짜봤는데 원하는 데이터는 나오지만 크로스 조인이 나서 이렇게 짜는 것이 맞는지 의문이 들어 여쭤보고싶습니다. 검색조건은 위에서 말씀드린 country와 language에서 language와 hopeLanguage로 변경하였습니다. Hibernate: select distinct user3_.id as col_0_0_, user3_.image_url as col_1_0_, user3_.content as col_2_0_, user3_.reg_date as col_3_0_, user3_.views as col_4_0_, (select count(tofollows6_.user_to_id) from follow tofollows6_ where user3_.id = tofollows6_.user_to_id) as col_5_0_ from user_language userlangua0_ cross join user_hope_language userhopela1_ inner join language language2_ on userlangua0_.language_id=language2_.id inner join user user3_ on userlangua0_.user_id=user3_.id inner join user user4_ on userhopela1_.user_id=user4_.id inner join language language5_ on userhopela1_.hope_language_id=language5_.id where user3_.id=user4_.id order by user3_.reg_date desc QUser user2=new QUser("user2");QLanguage language2=new QLanguage("language2");@Overridepublic List usersList(UserSearch userSearch, String school) { List usersList = queryFactory.select(Projections.constructor(UsersDto.class, user.id, user.imageUrl, user.content, user.regDate, user.views,user.toFollows.size())).distinct().from( userLanguage, userHopeLanguage) .join(userLanguage.language,language) .join(userLanguage.user,user) .join(userHopeLanguage.user,user2) .join(userHopeLanguage.hopeLanguage,language2) .where( hopeLanguageEq(userSearch.getHopeLanguage()) , languageEq(userSearch.getLanguage()) , nameEq(userSearch.getName()) , schoolEq(school) ,user.id.eq(user2.id) ).orderBy(searchOrder(userSearch.getOrder())) .fetch(); return usersList;}
- 0
- 4
- 223
질문&답변
조회질문
늦은시간에도 답변감사드립니다. 추가로 질문드려도될까요? language가 kor이고 country가 jap 와같이 조건이 동시에 붙었을때는 어떻게 쿼리문을 작성 할수있을까요?
- 0
- 4
- 223