Sjednoceno načítání názvu entity pro hibernate.

Změněn uživatel pro přístup do DB z admin na isspt.
multitenant
František Přibyl 11 years ago
parent 4451850603
commit af7f148f33

@ -4,10 +4,4 @@ import info.bukova.isspst.dao.AddressDao;
import info.bukova.isspst.data.Address;
public class AddressDaoJPA extends BaseDaoJPA<Address> implements AddressDao {
@Override
public String getEntityName() {
return Address.class.getSimpleName();
}
}

@ -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<T> implements BaseDao<T> {
protected Class<T> classTypeResolver;
@SuppressWarnings("unchecked")
public BaseDaoJPA()
{
this.classTypeResolver = (Class<T>) GenericTypeResolver.resolveTypeArgument(getClass(), BaseDaoJPA.class);
}
@Override
public String getEntityName() {
String className = classTypeResolver.getSimpleName();
return className;
}
private SessionFactory sessionFactory;
public void setSessionFactory(SessionFactory factory) {

@ -4,9 +4,4 @@ import info.bukova.isspst.dao.BuildingDao;
import info.bukova.isspst.data.Building;
public class BuildingDaoJPA extends BaseDaoJPA<Building> implements BuildingDao {
@Override
public String getEntityName() {
return "Building";
}
}

@ -4,9 +4,4 @@ import info.bukova.isspst.dao.MUnitDao;
import info.bukova.isspst.data.MUnit;
public class MUnitDaoJPA extends BaseDaoJPA<MUnit> implements MUnitDao {
@Override
public String getEntityName() {
return "MUnit";
}
}

@ -4,10 +4,4 @@ import info.bukova.isspst.dao.PermissionDao;
import info.bukova.isspst.data.Permission;
public class PermissionDaoJPA extends BaseDaoJPA<Permission> implements PermissionDao {
@Override
public String getEntityName() {
return Permission.class.getSimpleName();
}
}

@ -4,10 +4,4 @@ import info.bukova.isspst.dao.RoleDao;
import info.bukova.isspst.data.Role;
public class RoleDaoJPA extends BaseDaoJPA<Role> implements RoleDao {
@Override
public String getEntityName() {
return "Role";
}
}

@ -4,11 +4,4 @@ import info.bukova.isspst.dao.UserDao;
import info.bukova.isspst.data.User;
public class UserDaoJPA extends BaseDaoJPA<User> implements UserDao {
@Override
public String getEntityName() {
return "User";
}
}

@ -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

@ -1,14 +0,0 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page session="false" %>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>
Hello world!
</h1>
<P> The time on the server is ${serverTime}. </P>
</body>
</html>
Loading…
Cancel
Save