链接:https://pan.baidu.com/s/1ANHwBA1jLMtY6H-4jJnTQw
提取码:7ysq
//复制mybatis的jar包到lib文件中,全选,右键添加到build path中
//创建com.ye.mapper的包
//创建StudnetMapper的接口
public interface StudentMapper(){
pbulic student getStudent(int id){};
}
//复制xml文件重命名为StudentMapper.xml到com.ye.mapper路径下
<mapper namespace="com.ye.mybatis.StudentMapper">
<select id="getStudnet" ParameterType="int" resultType="com.ye.studnet">
seclect * from student where id=#{id}
</seclect>
<mapper>
//复制mybatis-config.xml到src路径下
<configuration>
<environments default="development">
<environment id="development">
<transactionManage type="JDBC" />
<datasourse type="POOLED">
<property name="driver" value="com.mysql.jdbc.driver" />
<property name="url" value="jdbc:mysql://localhost:3306/stubase" />
<property name="username" value="root" />
<property name="password" value="root" />
</datasourse>
</environment>
</environment>
<mappers>
<mapper resourse="com/ye/mapper/StudentMapper.xml">
</mappers>
</configuration>