commit 621e3fca1a1cda1d1a7f3f6bfb8bba7e17889c32
Author: Vojtěch Danišík <32537562+danisik@users.noreply.github.com>
Date:   Sat Jun 20 17:04:21 2020 +0200

    re #8144 #8143 #8148

diff --git a/src/main/java/vldc/aswi/domain/Assembly.java b/src/main/java/vldc/aswi/domain/Assembly.java
index b7a9eec3..274e43b5 100644
--- a/src/main/java/vldc/aswi/domain/Assembly.java
+++ b/src/main/java/vldc/aswi/domain/Assembly.java
@@ -44,7 +44,6 @@ public class Assembly extends EntityParent {
 
     /**
      * Creating new table with M:N relationship between Assembly and Role.
-     * Every assembly can be used by 0 - every role.
      */
     @ManyToMany
     @JoinTable(
diff --git a/src/main/java/vldc/aswi/domain/parameter/Parameter.java b/src/main/java/vldc/aswi/domain/parameter/Parameter.java
index 303f3d82..def7334a 100644
--- a/src/main/java/vldc/aswi/domain/parameter/Parameter.java
+++ b/src/main/java/vldc/aswi/domain/parameter/Parameter.java
@@ -47,7 +47,7 @@ public class Parameter extends EntityParent implements Comparable<Parameter> {
     private List<ParameterInConfiguration> parametersInConfiguration;
 
     /** List of parametersInConfiguration, which using this parameter. */
-    @OneToMany(mappedBy = "parameter")
+    @OneToMany(mappedBy = "parameter", fetch = FetchType.EAGER)
     private List<ParameterValue> parameterValues;
 
     /**
diff --git a/src/main/java/vldc/aswi/service/AssemblyManagerImpl.java b/src/main/java/vldc/aswi/service/AssemblyManagerImpl.java
index 8069106e..752f2cd7 100644
--- a/src/main/java/vldc/aswi/service/AssemblyManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/AssemblyManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.AssemblyRepository;
 import vldc.aswi.dao.RoleRepository;
@@ -42,8 +43,8 @@ public class AssemblyManagerImpl implements AssemblyManager {
     private ParameterManager parameterManager;
 
     /**
-     * Initialization setup for assembly manager. Check if assembly repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for assembly manager.
+     * Check if table "Sestava" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
@@ -51,9 +52,14 @@ public class AssemblyManagerImpl implements AssemblyManager {
     @Order(1)
     @Transactional
     public void setup() {
-        if (this.assemblyRepository.count() == 0) {
-            log.info("No assembly present, creating items.");
-
+        try {
+            if (this.assemblyRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Sestava\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java b/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java
index d40c94b5..f8afbb05 100644
--- a/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/ConfigurationManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.*;
 import vldc.aswi.dao.parameter.ParameterInConfigurationRepository;
@@ -59,18 +60,23 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
     private ParameterInConfigurationManager parameterInConfigurationManager;
 
     /**
-     * Initialization setup for configuration manager. Check if configuration repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for configuration manager.
+     * Check if table "Konfigurace" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
     })
-    @Order(1)
+    @Order(3)
     @Transactional
     public void setup() {
-        if (this.configurationRepository.count() == 0) {
-            log.info("No configuration present, creating items.");
-
+        try {
+            if (this.configurationRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Konfigurace\" did not exists in database!");
+            System.exit(1);
         }
     }
 
@@ -174,34 +180,37 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
         Configuration savedConfiguration = configurationRepository.save(configuration);
 
         savedConfiguration.setParametersInConfiguration(new ArrayList<>());
-        for(int i = 0; i < newConfiguration.getParametersInConfiguration().size(); i++) {
-            ParameterInConfiguration parameterInConfiguration = new ParameterInConfiguration();
-            parameterInConfiguration.setParameter(assembly.getParameters().get(i));
-            parameterInConfiguration.setConfiguration(savedConfiguration);
-            parameterInConfiguration.setParameterOrder(newConfiguration.getParametersInConfiguration().get(i).getParameterOrder());
-            parameterInConfiguration.setOperatorValue(newConfiguration.getParametersInConfiguration().get(i).getOperatorValue());
-            parameterInConfiguration.setColumnName(assembly.getParameters().get(i).getName());
-            if(newConfiguration.getParametersInConfiguration().get(i).getColumnName() != null &&
-                    !newConfiguration.getParametersInConfiguration().get(i).getColumnName().equals("")) {
-                parameterInConfiguration.setColumnName(newConfiguration.getParametersInConfiguration().get(i).getColumnName());
-            }
-            if(newConfiguration.getParametersInConfiguration().get(i).getLocation() != null) {
-                parameterInConfiguration.setLocation(locationRepository.getById(
-                        newConfiguration.getParametersInConfiguration().get(i).getLocation().getId()));
-            }
-            if(newConfiguration.getParametersInConfiguration().get(i).getOperator() != null) {
-                parameterInConfiguration.setOperator(operatorRepository.getByName(
-                        newConfiguration.getParametersInConfiguration().get(i).getOperator().getName()));
-            }
-            if(newConfiguration.getParametersInConfiguration().get(i).getFunctions() != null) {
-                parameterInConfiguration.setFunctions(new ArrayList<>());
-                for (Function function : newConfiguration.getParametersInConfiguration().get(i).getFunctions()) {
-                    parameterInConfiguration.getFunctions().add(functionRepository.getByName(function.getName()));
+
+        if (newConfiguration.getParametersInConfiguration() != null) {
+            for (int i = 0; i < newConfiguration.getParametersInConfiguration().size(); i++) {
+                ParameterInConfiguration parameterInConfiguration = new ParameterInConfiguration();
+                parameterInConfiguration.setParameter(assembly.getParameters().get(i));
+                parameterInConfiguration.setConfiguration(savedConfiguration);
+                parameterInConfiguration.setParameterOrder(newConfiguration.getParametersInConfiguration().get(i).getParameterOrder());
+                parameterInConfiguration.setOperatorValue(newConfiguration.getParametersInConfiguration().get(i).getOperatorValue());
+                parameterInConfiguration.setColumnName(assembly.getParameters().get(i).getName());
+                if (newConfiguration.getParametersInConfiguration().get(i).getColumnName() != null &&
+                        !newConfiguration.getParametersInConfiguration().get(i).getColumnName().equals("")) {
+                    parameterInConfiguration.setColumnName(newConfiguration.getParametersInConfiguration().get(i).getColumnName());
+                }
+                if (newConfiguration.getParametersInConfiguration().get(i).getLocation() != null) {
+                    parameterInConfiguration.setLocation(locationRepository.getById(
+                            newConfiguration.getParametersInConfiguration().get(i).getLocation().getId()));
+                }
+                if (newConfiguration.getParametersInConfiguration().get(i).getOperator() != null) {
+                    parameterInConfiguration.setOperator(operatorRepository.getByName(
+                            newConfiguration.getParametersInConfiguration().get(i).getOperator().getName()));
+                }
+                if (newConfiguration.getParametersInConfiguration().get(i).getFunctions() != null) {
+                    parameterInConfiguration.setFunctions(new ArrayList<>());
+                    for (Function function : newConfiguration.getParametersInConfiguration().get(i).getFunctions()) {
+                        parameterInConfiguration.getFunctions().add(functionRepository.getByName(function.getName()));
+                    }
                 }
+                ParameterInConfiguration savedParameterInConfiguration = parameterInConfigurationRepository.save(
+                        parameterInConfiguration);
+                savedConfiguration.getParametersInConfiguration().add(savedParameterInConfiguration);
             }
-            ParameterInConfiguration savedParameterInConfiguration = parameterInConfigurationRepository.save(
-                    parameterInConfiguration);
-            savedConfiguration.getParametersInConfiguration().add(savedParameterInConfiguration);
         }
         savedConfiguration = configurationRepository.save(savedConfiguration);
 
diff --git a/src/main/java/vldc/aswi/service/FunctionManagerImpl.java b/src/main/java/vldc/aswi/service/FunctionManagerImpl.java
index 5012fa34..d63c4bcc 100644
--- a/src/main/java/vldc/aswi/service/FunctionManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/FunctionManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.FunctionRepository;
 import vldc.aswi.domain.Function;
@@ -25,8 +26,8 @@ public class FunctionManagerImpl implements  FunctionManager {
     private FunctionRepository functionRepository;
 
     /**
-     * Initialization setup for function manager. Check if function repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for function manager.
+     * Check if table "Funkce" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
@@ -34,9 +35,14 @@ public class FunctionManagerImpl implements  FunctionManager {
     @Order(1)
     @Transactional
     public void setup() {
-        if (this.functionRepository.count() == 0) {
-            log.info("No function present, creating items.");
-
+        try {
+            if (this.functionRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Funkce\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/LocationManagerImpl.java b/src/main/java/vldc/aswi/service/LocationManagerImpl.java
index 0d37a71e..639cc783 100644
--- a/src/main/java/vldc/aswi/service/LocationManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/LocationManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.LocationRepository;
 import vldc.aswi.domain.Location;
@@ -25,8 +26,8 @@ public class LocationManagerImpl implements LocationManager {
     private LocationRepository locationRepository;
 
     /**
-     * Initialization setup for location manager. Check if location repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for location manager.
+     * Check if table "Umisteni" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
@@ -34,9 +35,14 @@ public class LocationManagerImpl implements LocationManager {
     @Order(1)
     @Transactional
     public void setup() {
-        if (this.locationRepository.count() == 0) {
-            log.info("No location present, creating items.");
-
+        try {
+            if (this.locationRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Umisteni\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/OperatorManagerImpl.java b/src/main/java/vldc/aswi/service/OperatorManagerImpl.java
index 3b3198b9..272ec2c8 100644
--- a/src/main/java/vldc/aswi/service/OperatorManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/OperatorManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.OperatorRepository;
 import vldc.aswi.domain.Operator;
@@ -25,8 +26,8 @@ public class OperatorManagerImpl implements OperatorManager {
     private OperatorRepository operatorRepository;
 
     /**
-     * Initialization setup for operator manager. Check if operator repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for operator manager.
+     * Check if table "Operator" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
@@ -34,9 +35,14 @@ public class OperatorManagerImpl implements OperatorManager {
     @Order(1)
     @Transactional
     public void setup() {
-        if (this.operatorRepository.count() == 0) {
-            log.info("No operator present, creating items.");
-
+        try {
+            if (this.operatorRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Operator\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/RoleManagerImpl.java b/src/main/java/vldc/aswi/service/RoleManagerImpl.java
index 53d07b67..f70b584e 100644
--- a/src/main/java/vldc/aswi/service/RoleManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/RoleManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.RoleRepository;
 import vldc.aswi.domain.Role;
@@ -25,23 +26,25 @@ public class RoleManagerImpl implements RoleManager {
     private RoleRepository roleRepository;
 
     /**
-     * Initialization setup for role manager. Check if role repository contains records and if not, initialize default values.
+     * Initialization setup for role manager.
+     * Check if table "Role" exists.
      */
-    /*
     @EventListener(classes = {
             ContextRefreshedEvent.class
     })
     @Order(1)
     @Transactional
     public void setup() {
-        if (this.roleRepository.count() == 0) {
-            log.info("No role present, creating 'Admin', 'Studijni referentka', 'Prorektor'.");
-            this.addRole("Admin");
-            this.addRole("Studijni referentka");
-            this.addRole("Prorektor");
+        try {
+            if (this.roleRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Role\" did not exists in database!");
+            System.exit(1);
         }
     }
-     */
 
     /**
      * Add newly created role into database.
diff --git a/src/main/java/vldc/aswi/service/UserManagerImpl.java b/src/main/java/vldc/aswi/service/UserManagerImpl.java
index e18e3dd3..5237e152 100644
--- a/src/main/java/vldc/aswi/service/UserManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/UserManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.security.core.userdetails.UserDetails;
 import org.springframework.security.core.userdetails.UserDetailsService;
 import org.springframework.security.core.userdetails.UsernameNotFoundException;
@@ -39,22 +40,23 @@ public class UserManagerImpl implements UserManager, UserDetailsService {
     private RoleRepository roleRepository;
 
     /**
-     * Initialization setup for user manager. Check if user repository contains records and if not, initialize default values.
+     * Initialization setup for user manager.
+     * Check if table "Uzivatel" exists.
      */
     @EventListener(classes = {
-            ContextRefreshedEvent.class
+            ContextRefreshedEvent.class,
     })
-    @Order(1)
+    @Order(2)
     @Transactional
     public void setup() {
-        if (this.userRepository.count() == 0) {
-            log.info("No user present");
-            /*
-            this.addUser("administrator", "demo", (long) 1);
-            this.addUser("fakulta", "demo", (long) 2);
-            this.addUser("referentka", "demo", (long) 3);
-            this.addUser("prorektor", "demo", (long) 4);
-             */
+        try {
+            if (this.userRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Uzivatel\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
index a5cc8610..cc8a2254 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterInConfigurationManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.parameter.ParameterInConfigurationRepository;
 import vldc.aswi.domain.Function;
@@ -27,18 +28,23 @@ public class ParameterInConfigurationManagerImpl implements ParameterInConfigura
     private ParameterInConfigurationRepository parameterInConfigurationRepository;
 
     /**
-     * Initialization setup for parameter in configuration manager. Check if parameter in configuration repository
-     * contains records and if not, initialize default values.
+     * Initialization setup for parameter in configuration manager.
+     * Check if table "Parametr_konfigurace" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
     })
-    @Order(1)
+    @Order(4)
     @Transactional
     public void setup() {
-        if (this.parameterInConfigurationRepository.count() == 0) {
-            log.info("No parameter in configuration present, creating items.");
-
+        try {
+            if (this.parameterInConfigurationRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Parametr_konfigurace\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
index 38f33b35..4db8ccf0 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.AssemblyRepository;
 import vldc.aswi.dao.FunctionRepository;
@@ -64,18 +65,23 @@ public class ParameterManagerImpl implements ParameterManager {
     private ParameterInConfigurationManager parameterInConfigurationManager;
 
     /**
-     * Initialization setup for parameter manager. Check if parameter repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for parameter manager.
+     * Check if table "Parametr" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
     })
-    @Order(1)
+    @Order(2)
     @Transactional
     public void setup() {
-        if (this.parameterRepository.count() == 0) {
-            log.info("No parameter present, creating items.");
-
+        try {
+            if (this.parameterRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Parametr\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterTypeManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterTypeManagerImpl.java
index 55cb03b3..a5fb6fec 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterTypeManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterTypeManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.parameter.ParameterTypeRepository;
 import vldc.aswi.domain.parameter.ParameterType;
@@ -25,8 +26,8 @@ public class ParameterTypeManagerImpl implements ParameterTypeManager {
     private ParameterTypeRepository parameterTypeRepository;
 
     /**
-     * Initialization setup for parameter type manager. Check if parameter type repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for parameter type manager.
+     * Check if table "Parametr_typ" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
@@ -34,9 +35,14 @@ public class ParameterTypeManagerImpl implements ParameterTypeManager {
     @Order(1)
     @Transactional
     public void setup() {
-        if (this.parameterTypeRepository.count() == 0) {
-            log.info("No parameter type present, creating items.");
-
+        try {
+            if (this.parameterTypeRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Parametr_typ\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java b/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java
index d96acdca..56a4b873 100644
--- a/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java
+++ b/src/main/java/vldc/aswi/service/parameter/ParameterValueManagerImpl.java
@@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.event.ContextRefreshedEvent;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.annotation.Order;
+import org.springframework.dao.InvalidDataAccessResourceUsageException;
 import org.springframework.stereotype.Service;
 import vldc.aswi.dao.parameter.ParameterRepository;
 import vldc.aswi.dao.parameter.ParameterValueRepository;
@@ -30,18 +31,23 @@ public class ParameterValueManagerImpl implements ParameterValueManager {
     private ParameterRepository parameterRepository;
 
     /**
-     * Initialization setup for parameter value manager. Check if parameter value repository contains
-     * records and if not, initialize default values.
+     * Initialization setup for parameter value manager.
+     * Check if table "Parametr_hodnota" exists.
      */
     @EventListener(classes = {
             ContextRefreshedEvent.class
     })
-    @Order(1)
+    @Order(3)
     @Transactional
     public void setup() {
-        if (this.parameterValueRepository.count() == 0) {
-            log.info("No parameter value present, creating items.");
-
+        try {
+            if (this.parameterValueRepository.count() == 0) {
+                // Just checking if table exists.
+            }
+        }
+        catch (InvalidDataAccessResourceUsageException e) {
+            log.error("Table \"Parametr_hodnota\" did not exists in database!");
+            System.exit(1);
         }
     }
 
diff --git a/src/main/java/vldc/aswi/validators/AssemblyValidator.java b/src/main/java/vldc/aswi/validators/AssemblyValidator.java
index ebdcfd8b..3b461c78 100644
--- a/src/main/java/vldc/aswi/validators/AssemblyValidator.java
+++ b/src/main/java/vldc/aswi/validators/AssemblyValidator.java
@@ -41,6 +41,10 @@ public class AssemblyValidator implements Validator {
         // Get assembly values.
         Assembly assembly = (Assembly) obj;
 
+        // Replace ";" with blank char -> semicolon is automatically added to statement before execution,
+        // so if SQL query already contains semicolon, it will raise exception.
+        assembly.setSQLQuery(assembly.getSQLQuery().replace(";", ""));
+
         // Validate SQL Query.
         List<String> columnNames = this.sqlQueryManager.getNameOfColumnsFromQuery(assembly.getSQLQuery());
 
