1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Session session = HibernateUtil.currentSession();
Transaction tx = session.beginTransaction();
Task util1;
switch( Integer.parseInt(odoper) ) {
case 1: // Ajout
_RootDAO.initialize();
TaskDAO c_dao = new TaskDAO();
Task ttt = new Task();
ttt.setDescript(txtdescript);
ttt.setDateTask(new Date());
ttt.setPriorite(txtpriorite);
ttt.setProjet(cmbprojet);
ttt.setExecuteur(cmbexecuteur);
ttt.setSuivi(cmbsuivi);
ttt.setMang(cmbmanag);
ttt.setTitle(txttitile);
ttt.setDescript(txtdescript);
ttt.setStatut("1");
c_dao.save(ttt);
break;
case 2: //Modif
// Suppression de l'utilisateur id = 26
util1 = (Task) session.load(Task.class, new Integer (3));
util1.setTitle("maow");
break;
case 3: //Supprim
// Suppression de l'utilisateur id = 26
util1 = (Task) session.load(Task.class, new Integer (3));
session.delete(util1);
break;
}
tx.commit();
HibernateUtil.closeSession();
} |
Partager