public static List findOne(String login, String senha) {
   Query query =
       JpaUtil.getEntityManager()
           .createQuery("select a from Usuario a where a.login = :vlogin and a.senha = :vsenha");
   query.setParameter("vlogin", login);
   query.setParameter("vsenha", senha);
   return query.getResultList();
 }
Exemplo n.º 2
0
 public void create(Lieu lieu) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   try {
     em.persist(lieu);
   } catch (Exception e) {
     throw e;
   }
 }
Exemplo n.º 3
0
 public Lieu update(Lieu lieu) throws Throwable {
   EntityManager em = JpaUtil.obtenirEntityManager();
   try {
     lieu = em.merge(lieu);
   } catch (Exception e) {
     throw e;
   }
   return lieu;
 }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
0
 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;
 }
Exemplo n.º 6
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;
 }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
0
  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;
  }
Exemplo n.º 9
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;
 }
Exemplo n.º 10
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;
 }
Exemplo n.º 11
0
  public static void main(String[] args) {
    // TODO code application logic here

    JpaUtil.creerEntityManager();

    ServiceInit.initialisationPays();
    ServiceInit.initialisationConseiller();
    ServiceInit.initialisationCircuit();
    ServiceInit.initialisationSejour();
    ServiceInit.initialisationInfoPrincipale();
    ServiceInit.initialisationClient(5);
    saisieInteractive();
  }