cayenne-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <>
Subject Max Length
Date Fri, 20 Aug 2010 12:20:39 GMT
One thing I recently added to our common/shared base class is:

     * Lookup the maximum database length defined in the Cayenne model for
     * the given attribute.
     * @param attribute The attribute to lookup.
     * @return The maximum length for the attribute.
    public int getMaxLength(String attribute)
        return getObjEntity().getAttributeMap().get(attribute).getDbAttribute().getMaxLength();

Would it make sense to add this to CayenneDataObject in 3.1?  We use
it to limit file upload sizes and do client-side validation in the UI.
 I could also see isMandatory() being useful, too.  Scale/precision
not as much, but might help some.




View raw message