final version

This commit is contained in:
Marcin Hutek 2024-01-02 19:31:08 +01:00
parent b40cfbc901
commit 835b816388

View File

@ -40,9 +40,9 @@ public class Queries {
// System.out.println("Film Title: " + filmTitle); // System.out.println("Film Title: " + filmTitle);
// System.out.println("Language: " + filmLanguage); // System.out.println("Language: " + filmLanguage);
// System.out.println("-----------------------------------"); // System.out.println("-----------------------------------");
// } // }
return results; return results;
} }
// ZAPYTANIE Z PARAMETREM // ZAPYTANIE Z PARAMETREM
public List<Object[]> getFilmByLangCategory(String categoryName, String languageName) { public List<Object[]> getFilmByLangCategory(String categoryName, String languageName) {
@ -81,10 +81,9 @@ public class Queries {
Query queryTotal = session.createQuery("Select count(f) from FilmModel f"); Query queryTotal = session.createQuery("Select count(f) from FilmModel f");
long countResult = (long)queryTotal.getSingleResult(); long countResult = (long)queryTotal.getSingleResult();
// create query
Query<FilmModel> query = session.createQuery("Select f from FilmModel f"); Query<FilmModel> query = session.createQuery("Select f from FilmModel f");
//page size and number of pages // rozmiar i liczba stron
int pageSize = 10; int pageSize = 10;
int pageTotal = (int) ((countResult / pageSize) + 1); int pageTotal = (int) ((countResult / pageSize) + 1);