Hi Steve,
Could you try the following and see if it works:
FileField myfield = new FileField("myfield") {
public Object getValueObject() {
if (getFileItem() != null) {
return getFileItem().get();
} else {
return super.getValueObject();
}
}
}
Click uses the method getValueObject to retrieve the Field value which is bound
to the domain object. By default FileField.getValueObject returns a String, not
byte[] array and thus the mapping between the Field and the Domain object fails.
I think we should enhance FileField to better handle this mapping. One issue
might be that blobs uses byte[] or InputStream while clobs uses char[] or
Reader. Perhaps we should change FileField so one can specify the type of the
data, ala HiddenField.
kind regards
bob
Steve Wells wrote:
Hi all,
I've only just begun using Click and so far it looks like a winner, well
done guys on a simple and effective framework. Finally things are
starting to look they way they should for the end-user developer! It
takes me way back to my Delphi days.
As a Cayenne user one of the most appealing facets was the slick
integration between the 2 frameworks.
I have hit my first snag trying to use a FileField that links
automagically to a Cayenne object field of type byte[] (db is BLOB).
The field displays fine but as it is a Cayenne mandatory the commit
fails with a Cayenne validation exception; it looks like the screen
field is not wired to the Cayenne field.
Is my approach wrong?
Thank you,
Steve