diff --git a/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/parentchild/dao/ParentchildDao.java b/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/parentchild/dao/ParentchildDao.java index d0d47ab5..535ee387 100644 --- a/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/parentchild/dao/ParentchildDao.java +++ b/umbba-domain/src/main/java/sopt/org/umbba/domain/domain/parentchild/dao/ParentchildDao.java @@ -41,13 +41,18 @@ public Optional findByUserId(Long userId) { public Optional findMatchUserByUserId(Long userId) { + QUser user = QUser.user; QUser uc = new QUser("uc"); return Optional.ofNullable(queryFactory .select(user) .from(user) - .join(uc).on(uc.parentChild.eq(user.parentChild)) - .where(uc.id.eq(userId).and(uc.id.ne(user.id))) + .where(user.id.ne(userId) + .and(user.parentChild.eq( + JPAExpressions.select(uc.parentChild) + .from(uc) + .where(uc.id.eq(userId)) + ))) .fetchOne()); }