0
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.

1
  • 3
    You have more chance in getting/finding answers when you show/use plain vanilla JPA instead of private/closed-source code. Simply substitute those getFacade() lines with normal JPA or at least show their source in minimal reproducible example flavor. Commented Nov 3 at 19:46

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.