I'm trying to replace "Transaction failed" with a message that will tell the user that they have violated a unique constraint.
The problem I'm having is that if I override the message in messages_en
it will be specific to unique constraints.
I tried overriding the FacesMessage in the EntityHome persist method but,
I'm gettting "The instance was not associated with this session" when I try to show that message on the page where the persist was attempted.
Here's the override:
@End
@Override
public String persist()
{
try {
super.persist();
titleXiProjectFolder.create(getInstance().getProjectName());
} catch (Exception e) {
FacesMessages.instance().add("Record already exists.'Project Name' must be unique");
return "failure";
}
return "success";
}