Most probably you missed the complete line
(List<Object>) getCurrentSession().createCriteria(Page.class).list();
Returns a list of Page
objects (pojo's) from database.
Your line
pages.addAll((List<Page>)getCurrentSession().createCriteria(Page.class)
.add(Restrictions.eq("path", pagePath))
.setMaxResults(1).list());
1)pages
is a list
2)
(List<Page>)getCurrentSession()
.createCriteria(Page.class)
.add(Restrictions.eq("path", pagePath))
.setMaxResults(1).list()
Here the list()
method on criteria Object return a list of Objects and here you are casting back them to Page objects,Since you know that they are Page objects
is a criteria to fetch
3) addAll
method adding all results to pages