Your error is
org.hibernate.TypeMismatchException: Provided id of the wrong type. Expected: class java.lang.Integer, got class java.lang.String
In your stacktrace we can see that dbd.create call others methods
at com.my.dao.DepartementImplDB.getDepartementByNom(DepartementImplDB.java:54)
at com.my.dao.DepartementImplDB.addDepartement(DepartementImplDB.java:29)
In your method
public Departement getDepartementByNom(String nomDepartement)
You try to load a departement with a name but you use session.load wich load by Id.
Departement dept = (Departement) session.load(Departement.class, nomDepartement);
You have to make a Criteria request to load by name. Like
session.beginTransaction();
Criteria criteria = session.createCriteria(Departement.class);
criteria.add(Restrictions.eq("nomDepartement", nomDepartement).ignoreCase());
result = (Departement) criteria.uniqueResult();
session.getTransaction().commit();
ps: In getDepartementById and getDepartementByNom you never end your transaction. Please use pattern like:
try {
session.beginTransaction();
// your code
session.getTransaction().commit();
} catch (HibernateException e) {
LOGGER.error(e);
if (session.getTransaction().isActive()) {
session.getTransaction().rollback();
}
}