我想将这些结果直接映射到映射模型类obj。 (例如ListModel.class),而不给出索引。 我认为RawRowMapper可以做到这一点,但不知道。

使用Dio映射模型类,

private Dao<News, Integer> newsDao = null;

public Dao<News, Integer> getNewsDao() {
    if (null == this.newsDao) {
        try {
            this.newsDao = getDao(News.class);
        } catch (java.sql.SQLException e) {
            e.printStackTrace();
        }
    }
    return this.newsDao;
}

public List<News> getAllNews() {
    List<News> news = null;
    try {
        news = getHelper().getNewsDao().queryForAll();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    return news;
}

它可以帮助您..

  相关解决方案