[ 
https://issues.apache.org/cayenne/browse/CAY-991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12756#action_12756
 ] 

Ari Maniatis commented on CAY-991:
----------------------------------

I agree with this. In fact I'd go further and suggest that validation SHOULD 
happen on the client since this would avoid a round trip to the server for no 
reason. In our application we currently manually add these validation elements 
to the client (outside of Cayenne) so that we can perform 
validation-as-you-type in a Swing GUI. In the long term of course we'd like to 
share our validation code between client and server, but this task would take 
us a small step in the right direction.

> isMandatory() and getMaxLength() should be members of ObjAttributeб not only 
> ClientObjAttribute
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAY-991
>                 URL: https://issues.apache.org/cayenne/browse/CAY-991
>             Project: Cayenne
>          Issue Type: Improvement
>          Components: Cayenne Core Library
>    Affects Versions: 3.0
>            Reporter: Andrey Razumovsky
>            Assignee: Andrus Adamchik
>            Priority: Minor
>
> While working on client side (using ROP) or server side, developer my access 
> isMandatory and getMaxLength properties of an ObjAttribute. On server this is 
> usually done by getDbAttribute().isMandatory() and 
> getDbAttribute().getMaxLength(). Since DbEntities are not being sent to 
> client, these two properties are manully set in ClientObjAttribute. So it 
> makes sense to make isMandatory() and getMaxLength() members of ObjAttribute 
> with reference to the same props of DbAttribute for server class, and 
> reference to own ClientObjAttribute class fields for clint implementation.
> This is important for validation, because current validateForSave() method of 
> CayenneDataObject cannot be anyhow applied to client objects. I don't think 
> client objects should by default implement Validating, because validation 
> code would execute twice this way (on client and on server). But still it 
> would be nice to see validation method somewhere (maybe in DataObjectUtils) 
> so that i could check my objects BEFORE commit

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to