Beispiel #1
0
 public Boolean ajouterDansBaseDeDonnees() {
   if (HibernateConnection.online == false) {
     ParamSync param = new ParamSync();
     param.setClinom(this.client.getClinom());
     param.setType("Ajout");
     Synchro sync = new Synchro();
     sync.objSerializable(this.client, param);
   }
   try {
     Transaction tx = HibernateConnection.getSession().beginTransaction();
     HibernateConnection.getSession().save(this.client);
     tx.commit();
     return true;
   } catch (HibernateException e) {
     System.out.println(e);
     return false;
   }
 }
Beispiel #2
0
 public synchronized Boolean updaterBaseDeDonnees(Client cli) {
   if (HibernateConnection.online == false) {
     ParamSync param = new ParamSync();
     param.setClinom(cli.getClinom());
     if (cli.isClisuppr() == true) {
       param.setType("Suppression");
     } else {
       param.setType("Mise à jour");
     }
     Synchro sync = new Synchro();
     sync.objSerializable(cli, param);
   }
   try {
     Transaction tx = HibernateConnection.getSession().beginTransaction();
     HibernateConnection.getSession().update(cli);
     tx.commit();
     return true;
   } catch (Exception e) {
     System.out.println(e);
     return false;
   }
 }