public void toggleBlacklistPatient(Patient patient, boolean blacklist){
if(patient == null || patient.getId() == null){
return;
}
if(blacklist && !patient.isBlacklisted()){
Patient newb= getFacade().find(patient.getId());
newb.setBlacklisted(true);
newb.setBlacklistedAt(new Date());
newb.setBlacklistedBy(sessionController.getLoggedUser());
newb.setReasonForBlacklist(patient.getReasonForBlacklist() != null ? patient.getReasonForBlacklist() + " / " + blacklistComment : blacklistComment);
// getFacade().edit(patient);
getFacade().editAndCommit(newb);
this.current = getFacade().findWithoutCache(newb.getId());
blacklistComment = null;
addSuccessMessage("Patient is blacklisted.");
Here I get a patient entity from another controller and use this patient controller to update fields when a user clicks a button in the UI button.
But the patient is not updated. I couldn't find any issue here that would cause this. This is normal way we need to follow.
Even when I update the patient field if I add sout it prints false and null for the Blacklisted and BlacklistedAt fields.