diff --git a/src/main/java/info/bukova/isspst/dao/jpa/AddressDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/AddressDaoJPA.java
index 92f605b5..db3de6fb 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/AddressDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/AddressDaoJPA.java
@@ -4,10 +4,4 @@ import info.bukova.isspst.dao.AddressDao;
import info.bukova.isspst.data.Address;
public class AddressDaoJPA extends BaseDaoJPA
implements AddressDao {
-
- @Override
- public String getEntityName() {
- return Address.class.getSimpleName();
- }
-
}
diff --git a/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java
index 6a3ef5ba..590ce4bb 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java
@@ -4,11 +4,27 @@ import java.util.List;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
+import org.springframework.core.GenericTypeResolver;
import info.bukova.isspst.dao.BaseDao;
public abstract class BaseDaoJPA implements BaseDao {
+ protected Class classTypeResolver;
+
+ @SuppressWarnings("unchecked")
+ public BaseDaoJPA()
+ {
+ this.classTypeResolver = (Class) GenericTypeResolver.resolveTypeArgument(getClass(), BaseDaoJPA.class);
+ }
+
+ @Override
+ public String getEntityName() {
+ String className = classTypeResolver.getSimpleName();
+ return className;
+ }
+
+
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory factory) {
diff --git a/src/main/java/info/bukova/isspst/dao/jpa/BuildingDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/BuildingDaoJPA.java
index 46a84cfe..7bd93c08 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/BuildingDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/BuildingDaoJPA.java
@@ -4,9 +4,4 @@ import info.bukova.isspst.dao.BuildingDao;
import info.bukova.isspst.data.Building;
public class BuildingDaoJPA extends BaseDaoJPA implements BuildingDao {
-
- @Override
- public String getEntityName() {
- return "Building";
- }
}
diff --git a/src/main/java/info/bukova/isspst/dao/jpa/MUnitDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/MUnitDaoJPA.java
index d91e95ac..fedbe03a 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/MUnitDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/MUnitDaoJPA.java
@@ -4,9 +4,4 @@ import info.bukova.isspst.dao.MUnitDao;
import info.bukova.isspst.data.MUnit;
public class MUnitDaoJPA extends BaseDaoJPA implements MUnitDao {
-
- @Override
- public String getEntityName() {
- return "MUnit";
- }
}
diff --git a/src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java
index 3edeff26..038c5ebe 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/MaterialDaoJPA.java
@@ -4,11 +4,4 @@ import info.bukova.isspst.dao.MaterialDao;
import info.bukova.isspst.data.Material;
public class MaterialDaoJPA extends BaseDaoJPA implements MaterialDao {
-
- @Override
- public String getEntityName() {
- return Material.class.getSimpleName();
- }
-
-
}
diff --git a/src/main/java/info/bukova/isspst/dao/jpa/PermissionDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/PermissionDaoJPA.java
index a4f7d5ba..5b65247b 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/PermissionDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/PermissionDaoJPA.java
@@ -4,10 +4,4 @@ import info.bukova.isspst.dao.PermissionDao;
import info.bukova.isspst.data.Permission;
public class PermissionDaoJPA extends BaseDaoJPA implements PermissionDao {
-
- @Override
- public String getEntityName() {
- return Permission.class.getSimpleName();
- }
-
}
diff --git a/src/main/java/info/bukova/isspst/dao/jpa/RoleDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/RoleDaoJPA.java
index 3fc92974..e5fbae3b 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/RoleDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/RoleDaoJPA.java
@@ -4,10 +4,4 @@ import info.bukova.isspst.dao.RoleDao;
import info.bukova.isspst.data.Role;
public class RoleDaoJPA extends BaseDaoJPA implements RoleDao {
-
- @Override
- public String getEntityName() {
- return "Role";
- }
-
}
diff --git a/src/main/java/info/bukova/isspst/dao/jpa/UserDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/UserDaoJPA.java
index b98028fd..06264c78 100644
--- a/src/main/java/info/bukova/isspst/dao/jpa/UserDaoJPA.java
+++ b/src/main/java/info/bukova/isspst/dao/jpa/UserDaoJPA.java
@@ -4,11 +4,4 @@ import info.bukova.isspst.dao.UserDao;
import info.bukova.isspst.data.User;
public class UserDaoJPA extends BaseDaoJPA implements UserDao {
-
-
- @Override
- public String getEntityName() {
- return "User";
- }
-
}
diff --git a/src/main/webapp/WEB-INF/jdbc.properties b/src/main/webapp/WEB-INF/jdbc.properties
index e203125f..63673eb4 100644
--- a/src/main/webapp/WEB-INF/jdbc.properties
+++ b/src/main/webapp/WEB-INF/jdbc.properties
@@ -1,5 +1,5 @@
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.dialect=org.hibernate.dialect.MySQLDialect
jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=latin2
-jdbc.username=root
+jdbc.username=isspst
jdbc.password=xsacfgd
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/views/home.jsp b/src/main/webapp/WEB-INF/views/home.jsp
deleted file mode 100644
index 47833836..00000000
--- a/src/main/webapp/WEB-INF/views/home.jsp
+++ /dev/null
@@ -1,14 +0,0 @@
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ page session="false" %>
-
-
- Home
-
-
-
- Hello world!
-
-
- The time on the server is ${serverTime}.
-
-