Originally posted by miguel lisboa:
just a guess:
looks like you'r translating from sql...
if you map Person and Phone as a parent/child relatioship your hql will be much simpler
take a look at docs that ship with install - there they have several parent/child examples
hope this helps
Originally posted by Nicholas Cheung:
I feel the question is defined in 2 levels. The 1st level should be the data type itself. As it is a phone number, it should be composed of numbers and dash. This level aims to check for data type only, because Struts validation framework aims for such pattern matching.
The 2nd level should be the business type validation, which should be done in the business logic. In such sense, why you wanna bind to the frontend checking? Why dont you allow your business logic to check it with DB, and throw something like InvalidPhoneNumberException? So, the ActionDispatcher finally catch this exception, and execute the "fail" path?
Originally posted by Marc Peabody:
Business Delegate Pattern - read this.
Keep in mind though that if it passes validation it might not still be valid when you try to submit it to the backend. Someone else may have been entering the same number at about the same time. Having a duplicate number might be better to not "validate" until you try to persist the data. That way, you make only one call to the backend and limit the risk of having a value pass validation but then not be valid when it is persisted.
[ November 05, 2004: Message edited by: Marc Peabody ]