This commit is contained in:
Maxime Dagnicourt
2008-02-12 11:10:54 +00:00
parent e6391c03f9
commit a0b72534aa

View File

@@ -161,11 +161,11 @@ public class UserManagerBean implements IUserManager{
this.UpdateUser(user); this.UpdateUser(user);
} }
public void removeSpecialityToUser(int specialityId, String login){ public void removeSpecialityFromUser(int specialityId, String login){
Query query = em.createQuery("delete from User u, u.specialities s WHERE s = ? and u = ?"); User user = this.getUser(login);
query.setParameter(1, this.getSpeciality(specialityId)); Speciality spe = this.getSpeciality(specialityId);
query.setParameter(2, this.getUser(login)); user.getSpecialities().remove(spe);
query.executeUpdate(); this.UpdateUser(user);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")