Beispiel #1
0
  /**
   * Returns the list of all Contact instances from the database.
   *
   * @return the list of all Contact instances from the database.
   */
  @SuppressWarnings("unchecked")
  public List<Blog> select() {

    SqlSessionFactory sqlSessionFactory = MyBatisConnectionFactory.getSqlSessionFactory();
    SqlSession session = sqlSessionFactory.openSession();

    try {
      List<Blog> list = session.selectList("Blog.selectBlog");
      return list;
    } finally {
      session.close();
    }
  }
Beispiel #2
0
  /**
   * Returns the list of all Contact instances from the database.
   *
   * @return the list of all Contact instances from the database.
   */
  public List<Blog> selectAnnotations() {

    SqlSessionFactory sqlSessionFactory = MyBatisConnectionFactory.getSqlSessionFactory();
    SqlSession session = sqlSessionFactory.openSession();

    try {

      BlogMapper mapper = session.getMapper(BlogMapper.class);
      List<Blog> list = mapper.selectAllBlogs();

      return list;
    } finally {
      session.close();
    }
  }