MyBatis를 이용, 예외가 발생했을 때, 분기를 나누는 방법.
- 서비스단에서 Mapper인터페이스를 호출할 때, DataAccessException으로 예외 분기를 나눌 수 있다.
- DataAccessException은 ......
@Log4j
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/root-context.xml")
public class ExceptionTests {
@Resource
private MemberMapper mapper;
@Test
public void testException() {
try {
Member member1 = new Member("aaa","aaa","aaa","aaa");
mapper.insertMember(member1);
}catch(DataAccessException e) {
log.info("#####"+e.getRootCause());
log.info("#####이미 회원으로 등록된 이메일입니다, 다른 이메일을 입력해주세요");
}
}
}
DataAccessException 은?