scanner:
1
2
3 |
<bean class = "org.mybatis.spring.mapper.MapperScannerConfigurer" > <property name= "basePackage"
value= "xx.dao;ss.dao"
/> </bean> |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 |
public Object execute(Object[] args) { Object result = null ; if
(SqlCommandType.INSERT == type) { Object param = getParam(args); result = sqlSession.insert(commandName, param); } else
if (SqlCommandType.UPDATE == type) { Object param = getParam(args); result = sqlSession.update(commandName, param); } else
if (SqlCommandType.DELETE == type) { Object param = getParam(args); result = sqlSession.delete(commandName, param); } else
if (SqlCommandType.SELECT == type) { if
(returnsVoid && resultHandlerIndex != null ) { executeWithResultHandler(args); } else
if (returnsList) { result = executeForList(args); } else
if (returnsMap) { result = executeForMap(args); } else
{ Object param = getParam(args); result = sqlSession.selectOne(commandName, param); } } else
{ throw
new BindingException( "Unknown execution method for: "
+ commandName); } return
result; } |
再回掉SqlSessionTemplate的具体方法进行执行sql和resultMap。
其中涉及到事务的部分,走配置和特殊拦截器,默认无事务。
http://www.axure.org/tools/
原文:http://www.cnblogs.com/leeying/p/3590051.html