Commit f0751fa6 authored by Petr Adamek's avatar Petr Adamek
Browse files

Refactoring: getFullCategoryFromDb renamed to toEntity

parent 9c9fb1db
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ public class CategoryDao implements DataAccessObject<Category> {

            try (var rs = st.executeQuery()) {
                while (rs.next()) {
                    categories.add(getFullCategoryFromDb(rs));
                    categories.add(toEntity(rs));
                }
            }

@@ -135,7 +135,7 @@ public class CategoryDao implements DataAccessObject<Category> {

            try (var rs = st.executeQuery()) {
                if (rs.next()) {
                    var task = getFullCategoryFromDb(rs);
                    var task = toEntity(rs);

                    if (rs.next()) {
                        throw new DataAccessException("Multiple categories with id " + id + " found");
@@ -150,7 +150,7 @@ public class CategoryDao implements DataAccessObject<Category> {
        }
    }

    private Category getFullCategoryFromDb(ResultSet rs) throws SQLException {
    private Category toEntity(ResultSet rs) throws SQLException {
        var id = rs.getLong("ID");
        var category = new Category(
                rs.getString("TITLE"),