Programming Practice/Spring
query XML 에서 사용하는 Vo(Entity) type 의 alias 지정
효돌프
2014. 12. 14. 17:04
1. 배경
query XML 에서 parameterType 이나 resultMap 에서 Vo(Entity) 의 type(경로.class명)이 필요할 때가 있다. (parameter 나 result 가 Vo(Entity)에 담겨져 있을 때)
이때 type(경로.class명)을 type 이 필요할 때마다 적어주는 것은 불필요한 반복이다. 따라서 type 에 alias를 주고, alias를 type 에 적어주면, 불필요한 반복을 피할 수 있다.
2. 사용
1) mybatis-config.xml
2) DispatcherServlet-context.xml
3) queryXml 에서 type 에 경로.class명 대신 alias를 사용