-
1. Re: Generic Data Validation Questions.
benstarr Nov 26, 2003 7:41 PM (in response to john_anderson_ii)I believe you should always check the validity of data in the entity bean itself and not rely on any other part of the application to do that. Obviously for user-friendlyness and performance you may also want to check values in the user interface as well. Typically you would do simple checks (data type, format, length, range etc) in the user interface and more complex checks in the middle-tier (not to say that the simple checks shouldn't be performed in the middle-tier as well).
I'm not sure how to find the implementation of the findByPrimaryKey method. However, section 10.5.8.4 of the EJB 2.0 Specification states that an ObjectNotFoundException will be thrown by finder methods if the underlying object does not exist. ObjectNotFoundException is a subclass of FinderException. -
2. Re: Generic Data Validation Questions.
john_anderson_ii Dec 1, 2003 2:24 PM (in response to john_anderson_ii)Thanks, that helped a lot! Currently I've only been validating data on U/I side. But now that I see your point it makes much more sense to validate the data on the middle tier. Especially if I re-use the code someday.