[jboss-user] [JBoss Seam] - Transaction failed faces message

milesif do-not-reply at jboss.com
Fri Dec 15 11:35:14 EST 2006


Hi everybody,

I'm making some experiment with a class that extends EntityHome and overrides persist() in this way  (I need to show customized error messages when database constraints are violated):

	
  |         @Override 
  |         @Transactional
  |         public String persist() {
  | 		try {
  | 			return super.persist();
  | 		} catch (Exception e) {
  | 			facesMessages.addFromResourceBundle(SEVERITY_INFO, getMessageKeyPrefix() + "unique", "I got an error" );
  | 			return "persist";
  | 		}
  | 	}
  | 

When I insert a record that violates a constraint, I catch the exception and add a faces message. The problem is that the <h:messages tag in my page shows my message plus another one that says "Transaction failed", That message seems to be added by the framework after the persist() method has returned.  Where does that come from ? How can I eliminate or hide it ? 

Thanks in advance for helping

Ciao Francesco




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

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



More information about the jboss-user mailing list