[jboss-user] [JBoss Seam] - Overriding TransactionFailed error message

ector7280 do-not-reply at jboss.com
Tue Sep 25 10:53:36 EDT 2007

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";
  | 	}

Any ideas how to post this message on the calling page?



View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088451#4088451

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088451

More information about the jboss-user mailing list