public Resultat updateUser(List<SysMenu> listMenu,SysUsers user){
try{
EntityManager em=this.getEntityManager();
EntityTransaction tx=em.getTransaction();
tx.begin();
SysUsers sysUsers;
Object obj=this.find(SysUsers.class, user.getId(), em);
if(obj==null){
user.setSysAdherent(em.find(SysAdherent.class, user.getId().getIdAdherent()));
user.setPasswd(ToolsDao.getToolsDao().encodePassword(user.getId().getIdUser()));
user.setSysDatcre(new java.util.Date());
sysUsers=user;
persist(user, em);
this.persist(sysUsers, em);
}
else{
sysUsers=(SysUsers) obj;
sysUsers.setNom(user.getNom());
sysUsers.setPrenom(user.getPrenom());
sysUsers.setIsActiv(user.getIsActiv());
persist(sysUsers,em);
}
for(SysMenu menu:listMenu){
SysAccessUserId sysAccessUserId = new SysAccessUserId();
sysAccessUserId.setIdAdherent(user.getId().getIdAdherent());