You can use generics to make this simpler. Your getAllArticles
can return a list of Article
objects. It would look like this:
public static List<Article> getAllArticles(){
Session se=openSession();
List<Article> li= (List<Article>)(se.createCriteria(Article.class).list());
se.close();
return li;
}
Then you should be able to iterate over it using the loop you showed:
for(Article a : Boss.getAllArticles()){
//
}