#JC-1846 Replaced hql query with hibernate criteria for getting only one last post for branch cause of better performance