not known to the MapperRegistry with iBatis 3.0

   ibatis3.0使用错误提示:

 

not known to the MapperRegistry with iBatis 3.0

 

原因,没有注册Mapper,应该手动添加到mapper。

  SqlSessionFactory sqlMapper=new SqlSessionFactoryBuilder().build(reader); 
   sqlMapper.getConfiguration().addMapper(StudentDAO.class);

 

  然后在下面使用:

  StudentDao dao=session.getMapper(StudentDao.class);

 

以上注册mapper和<mapper namespace="com.ibatis3.dao.StudentDao">xml配置等效。

你可能感兴趣的:(DAO,xml,ibatis)