return ((Number) session.createQuery(hql).uniqueResult()).intValue();
}
private List<Branch> createAndSaveBranchList(int size, int sectionPosition) {
List<Branch> branches = new ArrayList<>();
Section section = ObjectsFactory.getDefaultSection();
section.setPosition(sectionPosition);
for (int i = 0; i < size; i++) {
Branch newBranch = new Branch("Branch #" + i, "Branch #" + i);
section.addOrUpdateBranch(newBranch);
newBranch.setSection(section);
branches.add(newBranch);
}
session.save(section);
return branches;