Constraint information is available by examining the ObjEntity and DbEntity objects corresponding to the given object class. I used this in the tapestry5-cayenne integration module (t5cayenne) to have tapestry automatically pick up the relevant data constraints Note: currently, t5cayenne supports the required constraint for any field type, the maxlength constraint for only string types, and no other constraints. This is due to what I was interested in supporting at the time I wrote it rather than to some fundamental limitation; any remaining constraints will likely be added at some point in the future. All of those caveats notwithstanding, you can take a look at the code for ideas:

http://code.google.com/p/tapestry5-cayenne/source/browse/trunk/tapestry5-cayenne-core/src/main/java/com/googlecode/tapestry5cayenne/services/CayenneConstraintGenerator.java

Robert

On Apr 13, 2009, at 4/136:26 PM , Weddle, Anthony wrote:

The documentation talks of removing validation as a concern of the GUI,
by using object validation that gets done before any commits. However,
validation can continue to be needed in the GUI since it is always nicer to let users know of problems early on (such as the maximum length of a
value, that a value must be a number or a value must not be null, as
well as business validation). Is there some way to have database
constraints visible to the GUI developer, perhaps through use of the
class generation templates (by adding constraints as constants in the
superclass, for example)?



Thanks,

Tony





NOTICE - This message and any attached files may contain information that is confidential, legally privileged or proprietary. It is intended only for use by the intended recipient. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error. Any dissemination, copying, use or re- transmission of this message or attachment, or the disclosure of any information therein, is strictly forbidden. BlueScope Steel Limited does not represent or guarantee that this message or attachment is free of errors, virus or interference.

If you have received this message in error please notify the sender immediately and delete the message. Any views expressed in this email are not necessarily the views of BlueScope Steel Limited.

Reply via email to