[jboss-user] [JBoss Seam] - Seam Gen messages
fady.matar
do-not-reply at jboss.com
Sat Feb 3 19:20:56 EST 2007
I have been playing around with Seam Gen, and I liked the approach and the source code generation is way better than the one by the previous Seam wizard by Hibernate tools.
I have a few questions to raise, I have updated one of the classes of my Entity Bean and update the persist and the update method since one of the fields is unique and I don't want to be redirected to the debug page.
The update was simple and I don't believe it is the right approach. Here's my code for the two methods.
| @Override
| public String persist() {
| try {
| return super.persist();
| } catch (Exception ex) {
| return null;
| }
| }
|
| @Override
| public String update() {
| try {
| return super.update();
| } catch (Exception ex) {
| return null;
| }
| }
|
Now I'm not redirected to the debug page, and a message Transaction Failed appears.
Here's the custom message I have added to provide more feedback about the error to the end user:
| @Override
| public String persist() {
| try {
| return super.persist();
| } catch (Exception ex) {
| FacesMessages.instance().clear();
| FacesMessages.instance().add(
| "The name you has already been reserved.");
| return null;
| }
| }
|
| @Override
| public String update() {
| try {
| return super.update();
| } catch (Exception ex) {
| FacesMessages.instance().clear();
| FacesMessages.instance().add(
| "The name you has already been reserved.");
| return null;
| }
| }
|
I would like to take the "Transaction Failed" message and replace it with one specified above. The clear method did not take it out.
Any suggestions?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4010576#4010576
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4010576
More information about the jboss-user
mailing list