I am hoping to understand how to write a good wicket app regarding handling 
exceptions from the databsae layer?

For a wickt form, I can have the following to handle user submission: 

@Override
protected void onSubmit() {
  User u = getModelObject();
  userDao.saveUser(u);
  setResponsePage(Results.class);
}

For a wikcet web app, I can have many forms.

But what is the best way to handle common database exceptions such as foreign 
key constraint violation, larger than a column width, etc. and displaying 
meaningful error messages? I could easily add try/catch around userDao#saveUser 
to handle them, but that would be bad in terms of code replication and 
maintenance. It may be good to handle in a "central" place.

How do you deal with this issue in your wicket apps?

Thanks for input!

Best. 




      

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to