mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-05-14 01:21:49 +00:00
refacto(DevWeb): Remove EntityManager from DAO.java
This commit is contained in:
@@ -17,18 +17,13 @@ import jakarta.persistence.EntityManager;
|
||||
*/
|
||||
public abstract class DAO<D> {
|
||||
|
||||
/**
|
||||
* Gestionnaire d'entités
|
||||
*/
|
||||
protected EntityManager entityManager;
|
||||
|
||||
/**
|
||||
* Constructeur par défaut
|
||||
*
|
||||
* @throws DAOException si une erreur survient lors de la création du DAO
|
||||
*/
|
||||
public DAO() throws DAOException {
|
||||
this.entityManager = EntityManagerProvider.getInstance();
|
||||
throw new DAOException("DAO not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
|
||||
package uppa.project.dao.jpa;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import uppa.project.dao.DAO;
|
||||
import uppa.project.dao.DAOException;
|
||||
import uppa.project.pojo.Game;
|
||||
import uppa.project.provider.EntityManagerProvider;
|
||||
|
||||
/**
|
||||
* DAO pour les parties de jeu
|
||||
@@ -23,13 +25,18 @@ import uppa.project.pojo.Game;
|
||||
*/
|
||||
public class DAO_JPA_Game extends DAO<Game> {
|
||||
|
||||
/**
|
||||
* Gestionnaire d'entités
|
||||
*/
|
||||
private final EntityManager entityManager;
|
||||
|
||||
/**
|
||||
* Constructeur par défaut
|
||||
*
|
||||
* @throws DAOException si une erreur survient lors de la création du DAO
|
||||
*/
|
||||
public DAO_JPA_Game() throws DAOException {
|
||||
super();
|
||||
this.entityManager = EntityManagerProvider.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
|
||||
package uppa.project.dao.jpa;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import uppa.project.dao.DAO;
|
||||
import uppa.project.dao.DAOException;
|
||||
import uppa.project.pojo.Player;
|
||||
import uppa.project.provider.EntityManagerProvider;
|
||||
|
||||
/**
|
||||
* DAO pour les joueurs
|
||||
@@ -23,8 +25,13 @@ import uppa.project.pojo.Player;
|
||||
*/
|
||||
public class DAO_JPA_Player extends DAO<Player> {
|
||||
|
||||
/**
|
||||
* Gestionnaire d'entités
|
||||
*/
|
||||
private final EntityManager entityManager;
|
||||
|
||||
public DAO_JPA_Player() throws DAOException {
|
||||
super();
|
||||
this.entityManager = EntityManagerProvider.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,12 +6,14 @@
|
||||
|
||||
package uppa.project.dao.jpa;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.TypedQuery;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import uppa.project.dao.DAO;
|
||||
import uppa.project.dao.DAOException;
|
||||
import uppa.project.pojo.User;
|
||||
import uppa.project.provider.EntityManagerProvider;
|
||||
|
||||
/**
|
||||
* DAO pour les utilisateurs
|
||||
@@ -23,8 +25,13 @@ import uppa.project.pojo.User;
|
||||
*/
|
||||
public class DAO_JPA_User extends DAO<User> {
|
||||
|
||||
/**
|
||||
* Gestionnaire d'entités
|
||||
*/
|
||||
private final EntityManager entityManager;
|
||||
|
||||
public DAO_JPA_User() throws DAOException {
|
||||
super();
|
||||
this.entityManager = EntityManagerProvider.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
* Pas de copyright, aucun droits
|
||||
*/
|
||||
|
||||
package uppa.project.dao;
|
||||
package uppa.project.provider;
|
||||
|
||||
import jakarta.persistence.EntityManager;
|
||||
import jakarta.persistence.EntityManagerFactory;
|
||||
Reference in New Issue
Block a user