Hi,
Originally posted by Nova Chen:
But, if I update a record with the values same as to another record, it should throw DuplicateKeyException. Is it right? How shall I take care of this situation?
thanks!
I'll answer your questions indirectly.
For client of the interface declaration of exception means that declared exception
might be thrown and he is forced to do something in catch clause. For implementation provider declaration of exception means that there is only a possibilty to thow exception under well defined circumstance. So, you have to ask yourself: do I know how to define the key fields? Is it a normal situation to have two records with the same field values? What was the intension behind it? Maybe extensibility?
Originally posted by Nova Chen:
Another One, do I need to do the check of the field values to be filled in? like the "$" sign before the price number, or the positive integer for the number of workers.
Probably your data access classes are generic and knows nothing about the meaning of field values. The number of workers isn't even a number, it is nothing more than
string.
If so, the only way to conform the type of field is to valide/convert values in code that depends upon your data access code.