๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ”ฅ ํ”„๋กœ์ ํŠธ/์›จ๋”ฉ๋ฉ”์ดํŠธ

[์ง€์‹] ๋ฉ”์„œ๋“œ ์ฐธ์กฐ์™€ ์ƒ์„ฑ์ž ์ฐธ์กฐ

by nitronium102 2023. 7. 28.
@Transactional(readOnly = true)
public void checkUserIsRegistered(Users users) {
    if (hasPlanner(users))
        throw new PlannerDuplicateRegistrationException();

    if (hasCustomer(users))
        throw new CustomerDuplicateRegistrationException();
}

PlannerDuplicateRegistrationException::new์™€ ๊ฐ™์ด ๋ฉ”์„œ๋“œ ์ฐธ์กฐ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋Š” ๋‹ค๋ฅธ ๋ฉ”์„œ๋“œ๋กœ ๋žŒ๋‹ค์‹์„ ์ „๋‹ฌํ•˜๊ฑฐ๋‚˜ ์ธํ„ฐํŽ˜์ด์Šค๋กœ์˜ ๋ณ€ํ™˜์„ ํ•  ๋•Œ ๋“ฑ์— ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์ƒ์„ฑ์ž๋ฅผ ํ˜ธ์ถœํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” ์ƒ์„ฑ์ž ์•ž์— ํด๋ž˜์Šค ์ด๋ฆ„์„ ๋ช…์‹œํ•˜์—ฌ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

๋Œ“๊ธ€