2 Replies Latest reply on Jan 6, 2010 12:23 PM by German Escobar

    File uplaod data overwritten on form upload if s:upload is empty

    Bryan Warren Newbie

      Hi all,

      I am new to Seam and I have a form that has a file upload field on form creation. The file is uploaded and can be downloaded fine. However when the user wants to edit that form and does not re-upload the file {the file choice is left blank} but makes changes elsewhere the file data is overwritten with blank informaiton. Any ideas as to why this might be happening?

      I am using Jboss 4.2 and Seam 2.1.0
      this is the file upload:

      <s:decorate id="fileUploadDecoration" template="layout/edit.xhtml">
                               <ui:define name="label">Add Attachment <br />
                               <s:fileUpload id="file"
                                    fileSize="#{voaformHome.instance.attachmentSize}"  />

      When the form is submitted with 1 change to the form but not the file the hibernate query that is generated always sets the value of the fileupload. this happens even with the hibernate dynamic update set to true as shown.

      @org.hibernate.annotations.Entity(dynamicUpdate = true)     
      public class Voaform implements java.io.Serializable {

      The resulting query (attachment... is the file upload params):

              timeofday=?,                //Seperate item updated
              attachmentContenttype=?,    //file
              attachmentName=?,           //file
              attachmentData=?,           //file
              attachmentSize=?            //file

      I am not sure if this is a hibernate issue or a seam issue.
      Any help is appreciated.