@Test public void testUpdateAuthor() throws Exception { Assert.assertEquals(true, authorService.updateAuthor(new Author(2, "star_year")) > 0); }
@Override public int updateAuthor(Author author) { SqlSession sqlSession = null; try { sqlSession = MybatisUtil.getSqlSession(); AuthorMapper authorMapper = sqlSession.getMapper(AuthorMapper.class); int result = authorMapper.updateAuthor(author); sqlSession.commit(); return result; } finally { if (sqlSession != null) { sqlSession.close(); } } }
AuthorServiceImpl implements AuthorService { @Override public int updateAuthor(Author author) { SqlSession sqlSession = null; try { sqlSession = MybatisUtil.getSqlSession(); AuthorMapper authorMapper = sqlSession.getMapper(AuthorMapper.class); int result = authorMapper.updateAuthor(author); sqlSession.commit(); return result; } finally { if (sqlSession != null) { sqlSession.close(); } } } }
AuthorServiceImpl implements AuthorService { @Override public int updateAuthor(Author author) { SqlSession sqlSession = null; try { sqlSession = MybatisUtil.getSqlSession(); AuthorMapper authorMapper = sqlSession.getMapper(AuthorMapper.class); int result = authorMapper.updateAuthor(author); sqlSession.commit(); return result; } finally { if (sqlSession != null) { sqlSession.close(); } } }  }
AuthorServiceImpl implements AuthorService { @Override public int updateAuthor(Author author) { SqlSession sqlSession = null; try { sqlSession = MybatisUtil.getSqlSession(); AuthorMapper authorMapper = sqlSession.getMapper(AuthorMapper.class); int result = authorMapper.updateAuthor(author); sqlSession.commit(); return result; } finally { if (sqlSession != null) { sqlSession.close(); } } }  @Override int addAuthor(Author author); @Override int deleteAuthor(int authorId); @Override int updateAuthor(Author author); @Override List<Author> getAllAuthors(); @Override int getAllAuthorsCount(); }
AuthorServiceImpl implements AuthorService { @Override public int updateAuthor(Author author) { SqlSession sqlSession = null; try { sqlSession = MybatisUtil.getSqlSession(); AuthorMapper authorMapper = sqlSession.getMapper(AuthorMapper.class); int result = authorMapper.updateAuthor(author); sqlSession.commit(); return result; } finally { if (sqlSession != null) { sqlSession.close(); } } }  @Override int addAuthor(Author author); @Override int deleteAuthor(int authorId); @Override int updateAuthor(Author author); @Override List<Author> getAllAuthors(); @Override int getAllAuthorsCount();  }