inflearn logo
Course

Course

Instructor

ykmykm4608's Posts

ykmykm4608 ykmykm4608

@ykmykm46089813

Reviews Written
-
Average Rating
-

Posts 3

Q&A

JPQL 동적쿼리 부분 - > QUERYDSL 마이그레이션 후 질문

혹시 fetchjoin 적용 안된거 같은데 할필요가 없는걸까요? public List findTransactionList(Long accountId, String gubun, Integer page){ JPAQuery query = jpaQueryFactory.selectFrom(transaction); return query .leftJoin(transaction.withdrawAccount).leftJoin(transaction.depositAccount) .where(gubunCheck(gubun, accountId)) .limit(3).offset(page*3) .fetch(); } private BooleanExpression gubunCheck(String gubun, Long accountId){ if (!StringUtils.hasText(gubun)){ return transaction.withdrawAccount.id.eq(accountId).or(transaction.depositAccount.id.eq(accountId)); }else if(TransactionEnum.valueOf(gubun) == TransactionEnum.DEPOSIT){ return fetchjtransaction.depositAccount.id.eq((accountId)); }else if(TransactionEnum.valueOf(gubun) == TransactionEnum.WITHDRAW){ return transaction.withdrawAccount.id.eq(accountId); }else { return null; } }

Likes
0
Comments
2
Viewcount
527