I'm currently using gwt 2.3 and smartclient power 2.5 nightly. I am following the example in the smartclient showcase for uploading a file using the FileItem. The oracle table has a field called File_CONTENTS that is a BLOB, and in my data source I have it marked as type="binary" and hidden="true". I added the _date_created, _filesize & _filename columns to the table. This is the error I get:
Here is my java code:
This is what my datasource looks like:
Also, the insert statement fails b/c the MOD_TIMESTAMP field is null. How do I tell the add operation to auto generate a timestamp on insertion? I tried adding the field to the dynamicform that the upload button is on but it still was not included in the insert statement. Do I have to override the add operation binding? If so, can you give me an example?
Code:
=== 2011-10-05 14:43:05,288 [l0-7] WARN Validation - [builtinApplication.AttachedFileDataSource_add] No such type 'binary', not processing field value at /AttachedFileDataSource/FILE_CONTENTS
Code:
// create the form that will be used to upload any addendum // and set the data source for it final DynamicForm uploadForm = new DynamicForm(); uploadForm.setDataSource( DataSource.getDataSource(RELATED_DATA_SOURCE_NAME)); // create the file item to allow the user to select the // file to be uploaded FileItem theFile = new FileItem(FILE_CONTENTS, ADD_ATTACHMENT); // create the button item to commit the file upload ButtonItem upload = new ButtonItem(UPLOAD, UPLOAD); // add the clickhandler to the button item to perform // the upload to the database upload.addClickHandler(new com.smartgwt.client.widgets.form.fields.events.ClickHandler() { /** * when the upload button is clicked the smartgwt framework * will make and rpc and save the file to the PQD */ @Override public void onClick( com.smartgwt.client.widgets.form.fields.events.ClickEvent event) { uploadForm.saveData( new com.smartgwt.client.data.DSCallback() { @Override public void execute(DSResponse response, Object rawData, DSRequest request) { uploadForm.editNewRecord(); } }); } }); // add the fields to the dynamic form uploadForm.setFields(Id, theFile, upload, modTimestamp);
Code:
<field name="FILE_CONTENTS" type="binary" hidden="true"/> <field name="MOD_TIMESTAMP" type="modifiertimestamp" length="11" hidden="true"/>
Comment