• Post Reply Bookmark Topic Watch Topic
  • New Topic

Validation of max column length and error message  RSS feed

 
Ted Bell
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I was recently assigned to take over an application where an entity bean creates records in a table, and was unsure of the validation on the column length.
As it stands now, the client is passed a gneric error message stating simply that the record could not be added (the SQLException is wrapped in an application-specific exception), but nothing tells the client which field failed validation.
So my question is - should the applicaiton logic handle checking for maximum lengths before attempting to persist the record? If so, doesn't this add more administrative overhead (perhaps it's worth it)? And if not, how to tell the client which field he needs to change?
Thanks for any input.
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Art Vandelay:
Hi all,
I was recently assigned to take over an application where an entity bean creates records in a table, and was unsure of the validation on the column length.
As it stands now, the client is passed a gneric error message stating simply that the record could not be added (the SQLException is wrapped in an application-specific exception), but nothing tells the client which field failed validation.
So my question is - should the applicaiton logic handle checking for maximum lengths before attempting to persist the record? If so, doesn't this add more administrative overhead (perhaps it's worth it)? And if not, how to tell the client which field he needs to change?
Thanks for any input.

I thought it's very common to handle such errors @ the client layer itself.
I mean typical javascript checks if it's a web application. That way it becomes easier to report errors as well. Do not send any data to the persistence tier without making sure that entered data is atleast complete and correct. Ofcourse there might be some business logic validations that need to be done which has to be done @ the server layer.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!