cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Razumovsky (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CAY-991) isMandatory() and getMaxLength() should be members of ObjAttributeб not only ClientObjAttribute
Date Thu, 04 Dec 2008 20:38:11 GMT

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

Andrey Razumovsky commented on CAY-991:
---------------------------------------

Returning to this issue, I think I agree with Ari - mandatory and max-length validation should
by default be done by CayenneContext. This requires PersistentObject to implement Validating,
and probably some changes in context API, like moving set(is)ValidatingObjectsOnCommit methods
up to BaseContext.
This way every commit on client will be a bit longer, but bad data will not be sent to server
side. 

> 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: Andrey Razumovsky
>            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.


Mime
View raw message