Code example for ArrayList

Methods: addAll

0
            dao.createOrUpdate(cacheEntry);
        } 
    } 
 
    public <T> List<T> queryForAllFromDatabase(Class<T> modelObjectClass) throws SQLException {
        List<T> allObjectsInTable = new ArrayList<T>();
        Dao<T, ?> dao = getDao(modelObjectClass);
        allObjectsInTable.addAll(dao.queryForAll());
        return allObjectsInTable;
    } 
 
    public <T, ID> T queryForIdFromDatabase(ID id, Class<T> modelObjectClass) throws SQLException {
        Dao<T, ID> dao = getDao(modelObjectClass);
        T result = dao.queryForId(id);
 
        return result;
    } 
 
    public CacheEntry queryCacheKeyForIdFromDatabase(String id) throws SQLException {
        Dao<CacheEntry, String> dao = getDao(CacheEntry.class);
        return dao.queryForId(id);