猎头职位: 相关文章: 对于整合Spring及Mybatis不作详细介绍,可以参考: MyBatis 3 User Guide Simplified Chinese.pdf,贴出我的主要代码如下: UserMapper Interface: package org.denger.mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.denger.po.User; public interface UserMapper { @Select("select * from tab_uc_account where id=#{userId}") User getUser(@Param("userId") Long userId); } application-context.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/context http://www.springframework.org/schema/aop http://www.springframework.org/schema/tx "> <!-- Provided by annotation-based configuration --> <context:annotation-config/> <!--JDBC Transaction Manage --> <bean> <constructor-arg> <ref bean="dataSource" /> </constructor-arg> </bean> <!-- The JDBC c3p0 dataSource bean--> <bean destroy-method="close"> <property value="com.mysql.jdbc.Driver" /> <property value="jdbc (责任编辑:JavaVideo) |
