Hi Philip
Only personnal opinions following, based on experience.
Your topic is mainly, as I understood, discussing validation rules but with the specific case of cardinality.
Like in many situations, there is more than one way to get the acheived goal. The solution you described is one. The implementation of validation rules is a very sensitive area. Validation should normally occur at data entry level. Once you've reach the business layer in an application, all validation should already be done because business objects are, after all, very trusting creature. Capturing these errors at entry level lowers the number of lines of code that will acutally need to perform that same exact check deeper in the soft.
With the described method, using triggers, the validation occurs quite late in the process. We're all the way down to the DB and its getting late for validation but not to late :). In Java, it means the your business layer as made a call to your data layer. Should the error be allowed to travel that far in code?
The schema defined and used by common-sql is specialized in one area : offering a model to create DB scripts and other niceties. And since validation rules are applied to an "entity" in an application and not on a table itself ( but that does not mean that no rules should be implemented in the DB) is not the right model to put this information in. Its maybe better to put these rules in the domain model. These will have an impact on other that DB code anyway.
Eric.
Philip DONAGHY wrote:
We are making a datamodel from xml schema and would like to suggest support for constraints in a similar way xml schema does it. For example if an element of an xml instance can contain a maximum of 3 child elements (maxOccurs="3"), can the commons sql datamodel add a "trigger before insert" which verifies that there are not more than 3 children inserted in the child table. The same could be done for "trigger before delete" for minOccurs constraints.
What does the Apache community of Java Thinkers make of this nasty idea :p
Any other ideas for xml schema-like support in the relational database model.
If this is not a good idea what would be the alternatives?
Philip Donaghy and Olivier Croisier
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
