Hi all,
As I was implementing the auto validation thing, I got to a problem
that I want to know your opinion about it. Doing the validation for
mandatory fields is ok, but when it comes to length, precision and dates
it becomes tricky. That is because one could possibly change the mapping
Java->DB and DB->Java. So using DbAttribute.getType() doesn't do it
because a char could map either a Boolean or a String (or anything
else). Using ObjAttribute.getType() doesn't do also because one may want
to map a Date to varchar(2000) having no upper or lower limit (sorry,
couldn't come up with a better example :-) ). Also different databases
may (and do) have different boundaries values (I'm not sure whether this
is mapped correctly to max length and precision with the modeler?)
One way of doing this is to add a validate(ValidationResult) method
to the ExtendedType interface. Then every mapping could check whether
the property value can be correctly mapped to the DB. How does that sound?
Thanks for your patience,
Fabricio
This archive was generated by hypermail 2.0.0 : Tue Sep 16 2003 - 12:23:51 EDT