예제 #1
0
파일: LieuDao.java 프로젝트: JohnnyGuye/TPs
 public void create(Lieu lieu) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   try {
     em.persist(lieu);
   } catch (Exception e) {
     throw e;
   }
 }
예제 #2
0
파일: LieuDao.java 프로젝트: JohnnyGuye/TPs
 public Lieu update(Lieu lieu) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   try {
     lieu = em.merge(lieu);
   } catch (Exception e) {
     throw e;
   }
   return lieu;
 }
예제 #3
0
 public static Adherent update(Adherent adherent) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   try {
     adherent = em.merge(adherent);
   } catch (Exception e) {
     throw e;
   }
   return adherent;
 }
예제 #4
0
파일: LieuDao.java 프로젝트: JohnnyGuye/TPs
 public Lieu findById(long id) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   Lieu lieu = null;
   try {
     lieu = em.find(Lieu.class, id);
   } catch (Exception e) {
     throw e;
   }
   return lieu;
 }
예제 #5
0
 public static Adherent findById(long id) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   Adherent adherent = null;
   try {
     adherent = em.find(Adherent.class, id);
   } catch (Exception e) {
     throw e;
   }
   return adherent;
 }
예제 #6
0
 public static List<Adherent> findAll() throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   List<Adherent> adherents = null;
   try {
     Query q = em.createQuery("SELECT a FROM Adherent a");
     adherents = (List<Adherent>) q.getResultList();
   } catch (Exception e) {
     throw e;
   }
   return adherents;
 }
예제 #7
0
파일: LieuDao.java 프로젝트: JohnnyGuye/TPs
  public List<Lieu> findAll() throws Throwable {
    EntityManager em = JpaUtil.obtenirEntityManager();
    List<Lieu> lieux = null;
    try {
      Query q = em.createQuery("SELECT l FROM Lieu l");
      lieux = (List<Lieu>) q.getResultList();
    } catch (Exception e) {
      throw e;
    }

    return lieux;
  }
예제 #8
0
 public static boolean create(Adherent adherent) throws Throwable {
   if (adherent.getLatitude() != null) {
     EntityManager em = JpaUtil.obtenirEntityManager();
     try {
       em.persist(adherent);
       return true;
     } catch (Exception e) {
       throw e;
     }
   }
   return false;
 }
예제 #9
0
 public static Adherent findByMail(String mail) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   Adherent adherent = null;
   try {
     Query q = em.createQuery("SELECT a FROM Adherent a WHERE a.mail=:mail");
     q.setParameter("mail", mail);
     adherent = (Adherent) q.getSingleResult();
   } catch (Exception e) {
     throw e;
   }
   return adherent;
 }