Search code examples
hibernatefine-uploader

FineUploader send pictures one after another


So basically i am trying to make the FineUploader work with autoUpload set to false. When i call uploadStoredFiles() I want FineUploader to send a request for the first picture and wait for the response of this request and after that send the second request for the second picture and so on.. . I want to achieve this effect beacuase when FineUploader sends the requests simultaneously some of the pictures do not get saved in the database. I am using Hibernate and i suspect that some picutres do not get uploadeted in their row because Hiberante is already working with this row and another thread cannot work with the same row and because of that it would be much easier if I could make FineUploader send teh reqeuests one after another. I was trying to research about optimistic and pessimistic concurrency but it just confused me even more. Thanks in advance.


Solution

  • To avoid concurrent file upload you can set the FineUploader maxConnections property to 1 (it's defaulted to 3)

    https://docs.fineuploader.com/branch/master/api/options.html#maxConnections

    If you want to try to resolve the hibernate side of the issue (which is the actual problem) you need to post a lot more piece of your code than that.

    E.g. Hibernate version, Entities and logic where you persist/update those rows