Write a mapper tools, add and remove check to do some general, directly in the cited sqlSession,
want to ask next, each call to the add and check after the change, the session will automatically shut down? ??
@ Repository (value="https://bbs.csdn.net/topics/common")
Public class CommonMapper {
@ the Resource (name="sqlSession")
Private SqlSession session;
/* *
* general query
* @ param sqlid
* @ param obj
* @ return
*/
The public & lt; E> ListSelectForList (String statement, the Object parameter) {
Return this. The session. The selectList (statement, parameter);
}
/* *
* general update
* @ param statement sqlid
* @ param parameter parameters* @ return
*/
Public int updateForObj (String statement, the Object parameter) {
Return this. The session. The update (statement, parameter);
}
/* *
* general new
* @ param statement sqlid
* @ param parameter parameters* @ return
*/
Public int insertForObj (String statement, the Object parameter) {
Return this. The session. The insert (the statement, the parameter);
}
/* *
* general delete
* @ param statement sqlid
* @ param parameter parameters* @ return
*/
Public int deleteForObj (String statement, the Object parameter) {
Return this. The session. The delete (statement, parameter);
}
}
The classpath: mybatis - config. Xml
The classpath: com/test/spring/mapper/* mapper. Xml
CodePudding user response:
Need to have the code to display the shut downCodePudding user response: